summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerInternal.h
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-05-08 21:30:55 +0000
committerKostya Serebryany <kcc@google.com>2015-05-08 21:30:55 +0000
commit1ac8055bc7dd625bfe92f0d7f48f2ed6daa1ccda (patch)
tree233c190fb3b41cd28815d0bbe31c2e6b661df6d3 /llvm/lib/Fuzzer/FuzzerInternal.h
parentae0254dabca242f69e2d534097df84f810c7a2d0 (diff)
downloadbcm5719-llvm-1ac8055bc7dd625bfe92f0d7f48f2ed6daa1ccda.tar.gz
bcm5719-llvm-1ac8055bc7dd625bfe92f0d7f48f2ed6daa1ccda.zip
[lib/Fuzzer] use -fsanitize-coverage=trace-cmp when building LLVM with LLVM_USE_SANITIZE_COVERAGE; in lib/Fuzzer try to reload the corpus to pick up new units from other processes
llvm-svn: 236906
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerInternal.h')
-rw-r--r--llvm/lib/Fuzzer/FuzzerInternal.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerInternal.h b/llvm/lib/Fuzzer/FuzzerInternal.h
index 0fead355531..8363ef020b2 100644
--- a/llvm/lib/Fuzzer/FuzzerInternal.h
+++ b/llvm/lib/Fuzzer/FuzzerInternal.h
@@ -16,6 +16,7 @@
#include <string>
#include <vector>
#include <unordered_set>
+#include <set>
#include "FuzzerInterface.h"
@@ -25,7 +26,8 @@ using namespace std::chrono;
std::string FileToString(const std::string &Path);
Unit FileToVector(const std::string &Path);
-void ReadDirToVectorOfUnits(const char *Path, std::vector<Unit> *V);
+void ReadDirToVectorOfUnits(const char *Path, std::vector<Unit> *V,
+ long *Epoch);
void WriteToFile(const Unit &U, const std::string &Path);
void CopyFileToErr(const std::string &Path);
// Returns "Dir/FileName" or equivalent for the current OS.
@@ -54,6 +56,7 @@ class Fuzzer {
bool UseFullCoverageSet = false;
bool UseCoveragePairs = false;
bool UseDFSan = false;
+ bool Reload = true;
int PreferSmallDuringInitialShuffle = -1;
size_t MaxNumberOfRuns = ULONG_MAX;
std::string OutputCorpus;
@@ -65,9 +68,10 @@ class Fuzzer {
void ShuffleAndMinimize();
void InitializeDFSan();
size_t CorpusSize() const { return Corpus.size(); }
- void ReadDir(const std::string &Path) {
- ReadDirToVectorOfUnits(Path.c_str(), &Corpus);
+ void ReadDir(const std::string &Path, long *Epoch) {
+ ReadDirToVectorOfUnits(Path.c_str(), &Corpus, Epoch);
}
+ void RereadOutputCorpus();
// Save the current corpus to OutputCorpus.
void SaveCorpus();
@@ -116,6 +120,7 @@ class Fuzzer {
size_t TotalNumberOfRuns = 0;
std::vector<Unit> Corpus;
+ std::set<Unit> UnitsAddedAfterInitialLoad;
std::unordered_set<uintptr_t> FullCoverageSets;
std::unordered_set<uint64_t> CoveragePairs;
@@ -132,6 +137,7 @@ class Fuzzer {
system_clock::time_point ProcessStartTime = system_clock::now();
system_clock::time_point UnitStartTime;
long TimeOfLongestUnitInSeconds = 0;
+ long EpochOfLastReadOfOutputCorpus = 0;
};
}; // namespace fuzzer
OpenPOWER on IntegriCloud