summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerInternal.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerInternal.h')
-rw-r--r--llvm/lib/Fuzzer/FuzzerInternal.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerInternal.h b/llvm/lib/Fuzzer/FuzzerInternal.h
index d9331c662de..e6bef799f13 100644
--- a/llvm/lib/Fuzzer/FuzzerInternal.h
+++ b/llvm/lib/Fuzzer/FuzzerInternal.h
@@ -402,6 +402,13 @@ public:
// Public for tests.
void ResetCoverage();
+ bool InFuzzingThread() const { return IsMyThread; }
+ size_t GetCurrentUnitInFuzzingThead(const uint8_t **Data) const {
+ assert(InFuzzingThread());
+ *Data = CurrentUnitData;
+ return CurrentUnitSize;
+ }
+
private:
void AlarmCallback();
void CrashCallback();
@@ -463,6 +470,9 @@ private:
// Maximum recorded coverage.
Coverage MaxCoverage;
+
+ // Need to know our own thread.
+ static thread_local bool IsMyThread;
};
}; // namespace fuzzer
OpenPOWER on IntegriCloud