Skip to content

Commit

Permalink
Merge pull request #33 from mgeisler/mgeisler-cfg-fuzzing-repro
Browse files Browse the repository at this point in the history
Document `fuzzing_repro` in guide.md
  • Loading branch information
Manishearth committed Jun 16, 2023
2 parents 21ada89 + dfd11dd commit 09f169a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/cargo-fuzz/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ unsafe = ["project/unsafe"]

Every crate instrumented for fuzzing -- the `fuzz_targets` crate, the project crate, and their entire dependency tree -- is compiled with the `--cfg fuzzing` rustc option. This makes it possible to disable code paths that prevent fuzzing from working, e.g. verification of cryptographic signatures, with a simple `#[cfg(not(fuzzing))]`, and without the need for an externally visible Cargo feature that must be maintained throughout every dependency.

## `#[cfg(fuzzing_repro)]`

When you run `cargo fuzz <fuzz target name> <crash file>`, every crate is compiled with the `--cfg fuzzing_repro` rustc option. This allows you to leave debugging statements in your fuzz targets behind a `#[cfg(fuzzing_repro)]`:

```rust
#[cfg(fuzzing_repro)]
eprintln!("Input data: {}", expensive_pretty_print(&data));
```

## libFuzzer configuration options

See all the libFuzzer options:
Expand Down

0 comments on commit 09f169a

Please sign in to comment.