diff options
author | Kostya Serebryany <kcc@google.com> | 2016-09-21 22:42:17 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2016-09-21 22:42:17 +0000 |
commit | 29bb6640759f55a7092963dca3ef0287a9f5d140 (patch) | |
tree | 6ed23cf0c51af0d35971870baf7f6b28980e8247 /llvm/lib/Fuzzer/FuzzerInternal.h | |
parent | 0509203952fa0e6c1073dab2d9cce1e3beabab9f (diff) | |
download | bcm5719-llvm-29bb6640759f55a7092963dca3ef0287a9f5d140.tar.gz bcm5719-llvm-29bb6640759f55a7092963dca3ef0287a9f5d140.zip |
[libFuzzer] add stats to the corpus; more refactoring
llvm-svn: 282121
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerInternal.h')
-rw-r--r-- | llvm/lib/Fuzzer/FuzzerInternal.h | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerInternal.h b/llvm/lib/Fuzzer/FuzzerInternal.h index bc3f61a6e85..3142aac1187 100644 --- a/llvm/lib/Fuzzer/FuzzerInternal.h +++ b/llvm/lib/Fuzzer/FuzzerInternal.h @@ -18,14 +18,12 @@ #include <climits> #include <cstdlib> #include <string.h> -#include <unordered_set> #include "FuzzerDefs.h" #include "FuzzerExtFunctions.h" #include "FuzzerInterface.h" #include "FuzzerOptions.h" #include "FuzzerValueBitMap.h" -#include "FuzzerCorpus.h" namespace fuzzer { @@ -64,15 +62,13 @@ public: size_t VPMapBits; }; - Fuzzer(UserCallback CB, MutationDispatcher &MD, FuzzingOptions Options); + Fuzzer(UserCallback CB, InputCorpus &Corpus, MutationDispatcher &MD, + FuzzingOptions Options); ~Fuzzer(); - void AddToCorpus(const Unit &U) { Corpus.push_back(U); } void Loop(); void ShuffleAndMinimize(UnitVector *V); void InitializeTraceState(); void AssignTaintLabels(uint8_t *Data, size_t Size); - size_t CorpusSize() const { return Corpus.size(); } - void ReadDir(const std::string &Path, long *Epoch, size_t MaxSize); void RereadOutputCorpus(size_t MaxSize); size_t secondsSinceProcessStartUp() { @@ -113,11 +109,10 @@ private: void CrashCallback(); void InterruptCallback(); void MutateAndTestOne(); - void ReportNewCoverage(const Unit &U); + void ReportNewCoverage(InputInfo *II, const Unit &U); void PrintNewPCs(); void PrintOneNewPC(uintptr_t PC); bool RunOne(const Unit &U) { return RunOne(U.data(), U.size()); } - void RunOneAndUpdateCorpus(const uint8_t *Data, size_t Size); void WriteToOutputCorpus(const Unit &U); void WriteUnitToFileWithPrefix(const Unit &U, const char *Prefix); void PrintStats(const char *Where, const char *End = "\n"); @@ -158,11 +153,11 @@ private: bool HasMoreMallocsThanFrees = false; size_t NumberOfLeakDetectionAttempts = 0; - InputCorpus Corpus; - UserCallback CB; + InputCorpus &Corpus; MutationDispatcher &MD; FuzzingOptions Options; + system_clock::time_point ProcessStartTime = system_clock::now(); system_clock::time_point UnitStartTime; long TimeOfLongestUnitInSeconds = 0; |