summaryrefslogtreecommitdiff
path: root/lib/fuzzer/FuzzerInternal.h
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2017-11-09 20:30:19 +0000
committerKostya Serebryany <kcc@google.com>2017-11-09 20:30:19 +0000
commit5646b9ef2068f1577569226326f62d90e2de5f09 (patch)
tree2e561ae7a8c60e83555ca99bdd1589813f8b8ee2 /lib/fuzzer/FuzzerInternal.h
parentc483d54d4a6d703121c3054a522f1eeb745287d2 (diff)
[libFuzzer] handle SIGUSR1/SIGUSR2 and try to exit grafully on these signals
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317829 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/fuzzer/FuzzerInternal.h')
-rw-r--r--lib/fuzzer/FuzzerInternal.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/fuzzer/FuzzerInternal.h b/lib/fuzzer/FuzzerInternal.h
index 371624408..cb26fe332 100644
--- a/lib/fuzzer/FuzzerInternal.h
+++ b/lib/fuzzer/FuzzerInternal.h
@@ -63,6 +63,7 @@ public:
static void StaticExitCallback();
static void StaticInterruptCallback();
static void StaticFileSizeExceedCallback();
+ static void StaticGracefulExitCallback();
void ExecuteCallback(const uint8_t *Data, size_t Size);
bool RunOne(const uint8_t *Data, size_t Size, bool MayDeleteFile = false,
@@ -94,6 +95,7 @@ private:
void AlarmCallback();
void CrashCallback();
void ExitCallback();
+ void MaybeExitGracefully();
void CrashOnOverwrittenData();
void InterruptCallback();
void MutateAndTestOne();
@@ -116,6 +118,8 @@ private:
uint8_t BaseSha1[kSHA1NumBytes]; // Checksum of the base unit.
bool RunningCB = false;
+ bool GracefulExitRequested = false;
+
size_t TotalNumberOfRuns = 0;
size_t NumberOfNewUnitsAdded = 0;