Skip to content

Commit

Permalink
Improve debugging docs (#1263)
Browse files Browse the repository at this point in the history
* Fix corrupted png's

* Add env to generated launch config

* Improve debugging docs
  • Loading branch information
jscissr authored Dec 21, 2022
1 parent d86245d commit 2190fd2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
Binary file modified docs/dependency-graph/images/design.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion docs/dev-guide/src/config/flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ When enabled, reborrowing DAGs will be output in debug files.

## `DUMP_VIPER_PROGRAM`

When enabled, the encoded Viper program will be output.
When enabled, the encoded Viper programs will be output.
You can find them either in `log/viper_program` or `target/verify/log/viper_program`.

## `ENABLE_CACHE`

Expand Down Expand Up @@ -265,6 +266,9 @@ When enabled, communication with the server will be encoded as JSON instead of t

Log level and filters. See [`env_logger` documentation](https://docs.rs/env_logger/0.7.1/env_logger/index.html#enabling-logging).

For example, `PRUSTI_LOG=prusti_viper=trace` enables trace logging for the prusti-viper crate.
Debug and trace logs are not available in release builds.

## `LOG_DIR`

Path to directory in which log files and dumped output will be stored.
Expand Down
12 changes: 10 additions & 2 deletions docs/dev-guide/src/development/debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the list of [flags](../config/flags.md) for way to configure Prusti. Of part

## Debugging tests

A proposed way of fixing Prusti limitations is to add a regression test and then use the following command to get Prusti output:
A proposed way of fixing Prusti limitations is to add a regression test by creating a new file in `prusti-tests/tests` and then use the following command to get Prusti output:

```bash
./x.py build --all && \
Expand All @@ -34,6 +34,15 @@ Tip: to see the expanded Prusti specification macros, add the following comment
// compile-flags: -Zunpretty=expanded
```

### Running Prusti in a debugger

The `verify-test` command also generates a VS Code launch config, which allows you to run Prusti in a debugger.

- In the `Cargo.toml`, section `[profile.dev]`, set `debug = 2`. This enables debug symbols.
- Install the CodeLLDB VS Code extension.

Now you can set breakpoints and launch the debugger.

### Debugging performance problems

In case you are debugging a performance problem and suspect that it is caused by quantifiers, append `--analyze-quantifiers` to the command after the `<path-to-the-test-file>`. This will run Z3 in tracing mode and produce CSV files with various statistics in `log/smt` directory. In case you want to see all terms that were used to trigger a specific quantifier, you can produce the list of them with the following command:
Expand All @@ -44,4 +53,3 @@ PRUSTI_SMT_TRACE_QUANTIFIER_TRIGGERS=<quantifier-id> \
```

You can find the list of quantifier ids and names in `log/smt/<function>/trace1.log.unique-triggers.csv`. Running the `smt-log-analyzer` will generate `log/smt/<function>/trace1.log.quantifier-<quantifier-id>-triggers.csv` file containing all triggers used to instantiate the quantifier.

Binary file modified docs/static/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions scripts/verify_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def generate_launch_json(args_file, env_file):
"--bin=prusti-driver",
"--package=prusti"
],
"env": get_env(),
"filter": {
"name": "prusti-driver",
"kind": "bin"
Expand Down

0 comments on commit 2190fd2

Please sign in to comment.