dump_interrupted.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  1. --- a/lib/fuzzer/FuzzerDriver.cpp
  2. +++ b/lib/fuzzer/FuzzerDriver.cpp
  3. @@ -657,4 +657,6 @@ int FuzzerDriver(int *argc, char ***argv, UserCallback Callback) {
  4. Options.ErrorExitCode = Flags.error_exitcode;
  5. Options.TimeoutExitCode = Flags.timeout_exitcode;
  6. + Options.InterruptExitCode = Flags.interrupted_exitcode;
  7. + Options.DumpInterrupted = Flags.dump_interrupted;
  8. Options.IgnoreTimeouts = Flags.ignore_timeouts;
  9. Options.IgnoreOOMs = Flags.ignore_ooms;
  10. --- a/lib/fuzzer/FuzzerFlags.def
  11. +++ b/lib/fuzzer/FuzzerFlags.def
  12. @@ -40,4 +40,7 @@ FUZZER_FLAG_INT(error_exitcode, 77, "When libFuzzer itself reports a bug "
  13. FUZZER_FLAG_INT(timeout_exitcode, 70, "When libFuzzer reports a timeout "
  14. "this exit code will be used.")
  15. +FUZZER_FLAG_INT(interrupted_exitcode, 0, "[arcadia] When libFuzzer intercepts a singal "
  16. + "this exit code will be used.")
  17. +FUZZER_FLAG_INT(dump_interrupted, 0, "[arcadia] If 1, dump current unit on signal.")
  18. FUZZER_FLAG_INT(max_total_time, 0, "If positive, indicates the maximal total "
  19. "time in seconds to run the fuzzer.")
  20. --- a/lib/fuzzer/FuzzerLoop.cpp
  21. +++ b/lib/fuzzer/FuzzerLoop.cpp
  22. @@ -263,4 +263,6 @@ void Fuzzer::MaybeExitGracefully() {
  23. void Fuzzer::InterruptCallback() {
  24. + if (Options.DumpInterrupted)
  25. + DumpCurrentUnit("interrupted-");
  26. Printf("==%lu== libFuzzer: run interrupted; exiting\n", GetPid());
  27. PrintFinalStats();
  28. --- a/lib/fuzzer/FuzzerOptions.h
  29. +++ b/lib/fuzzer/FuzzerOptions.h
  30. @@ -24,4 +24,5 @@ struct FuzzingOptions {
  31. int InterruptExitCode = 72;
  32. int ErrorExitCode = 77;
  33. + bool DumpInterrupted = false;
  34. bool IgnoreTimeouts = true;
  35. bool IgnoreOOMs = true;