diff options
| author | Matt Morehouse <mascasa@google.com> | 2017-07-20 20:43:39 +0000 |
|---|---|---|
| committer | Matt Morehouse <mascasa@google.com> | 2017-07-20 20:43:39 +0000 |
| commit | 9e689792b23b017507955dba1a0d21b239d4b869 (patch) | |
| tree | 4f9c3fb6fa5cdf34aa510b6456939ffed92e3d89 /llvm/lib/Fuzzer/FuzzerDriver.cpp | |
| parent | 0c8d26c312f62347e1640384c9a42fce97c2c657 (diff) | |
| download | bcm5719-llvm-9e689792b23b017507955dba1a0d21b239d4b869.tar.gz bcm5719-llvm-9e689792b23b017507955dba1a0d21b239d4b869.zip | |
Generate error reports when a fuzz target exits.
Summary:
Implements https://github.com/google/sanitizers/issues/835.
Flush stdout before exiting in test cases.
Since the atexit hook is used for exit reports, pending prints to
stdout can be lost if they aren't flushed before calling exit().
Expect tests to have non-zero exit code if exit() is called.
Reviewers: vitalybuka, kcc
Reviewed By: kcc
Subscribers: eraman, llvm-commits, hiraditya
Differential Revision: https://reviews.llvm.org/D35602
llvm-svn: 308669
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerDriver.cpp')
| -rw-r--r-- | llvm/lib/Fuzzer/FuzzerDriver.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerDriver.cpp b/llvm/lib/Fuzzer/FuzzerDriver.cpp index fd8cab38a7b..36d9422bc28 100644 --- a/llvm/lib/Fuzzer/FuzzerDriver.cpp +++ b/llvm/lib/Fuzzer/FuzzerDriver.cpp @@ -20,6 +20,7 @@ #include <algorithm> #include <atomic> #include <chrono> +#include <cstdlib> #include <cstring> #include <mutex> #include <string> @@ -642,6 +643,8 @@ int FuzzerDriver(int *argc, char ***argv, UserCallback Callback) { Options.HandleXfsz = Flags.handle_xfsz; SetSignalHandler(Options); + std::atexit(Fuzzer::StaticExitCallback); + if (Flags.minimize_crash) return MinimizeCrashInput(Args, Options); |

