[libFuzzer] set libFuzzer's own SEGV handler even one is already present, but call that handler from ours (unless we are unprotecting lazy counters). Call ProtectLazyCounters later, so that it runs after the initialization code in the target.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/fuzzer@352713 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/FuzzerDriver.cpp b/FuzzerDriver.cpp
index acebd3a..0f8389c 100644
--- a/FuzzerDriver.cpp
+++ b/FuzzerDriver.cpp
@@ -628,6 +628,7 @@
Options.FocusFunction = Flags.focus_function;
if (Flags.data_flow_trace)
Options.DataFlowTrace = Flags.data_flow_trace;
+ Options.LazyCounters = Flags.lazy_counters;
unsigned Seed = Flags.seed;
// Initialize Seed.
@@ -658,10 +659,7 @@
Options.HandleXfsz = Flags.handle_xfsz;
Options.HandleUsr1 = Flags.handle_usr1;
Options.HandleUsr2 = Flags.handle_usr2;
- Options.LazyCounters = Flags.lazy_counters;
SetSignalHandler(Options);
- if (Options.LazyCounters)
- TPC.ProtectLazyCounters();
std::atexit(Fuzzer::StaticExitCallback);