rust-fuzz / cargo-fuzz

Command line helpers for fuzzing
https://rust-fuzz.github.io/book/cargo-fuzz.html
Apache License 2.0
1.52k stars 109 forks source link

Suggest using --dev for a repro run with a given artifact #297

Open hsivonen opened 2 years ago

hsivonen commented 2 years ago

cargo fuzz run now defaults to release mode since #231. When it finds a failure and prints a command for how to run just that input, it doesn't suggest the --dev flag.

It would be good to suggest the --dev flag for repro, since the purpose of the repro run is presumably to be able to debug the failure, and the default mode seems to even lack sufficient debug info for source attachment.

fitzgen commented 2 years ago

I think that it should suggest exactly the command and flags that are known to reproduce the failure. It isn't unheard of for some crates to have cfgs that completely change code paths based on whether rustc has optimizations enabled or not, and suggesting --dev could make us miss bug-triggering code paths.

hsivonen commented 2 years ago

That's a good point. However, it's practically bad that the suggestion compiles without debug info, so the repro isn't useful at all for debugging the problem.

fitzgen commented 2 years ago

Yes, it's a trade off with no perfect solution and my inclination is to lean towards the "steps to reproduce will always reproduce" side.

Shnatsel commented 1 year ago

We could add debug level 2 to the defaults so that full debug info is available by default. Then there's no need to drop down to --dev.