summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerInternal.h
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-05-18 21:34:20 +0000
committerKostya Serebryany <kcc@google.com>2015-05-18 21:34:20 +0000
commit2da7b8485248c27083318302c30462ddbb5396ca (patch)
tree87e971d0edcf9040bf20121d2bf40fde54d81d11 /llvm/lib/Fuzzer/FuzzerInternal.h
parent1638f987f11fa1f8b4292b476b0ee3b92ca9b84c (diff)
downloadbcm5719-llvm-2da7b8485248c27083318302c30462ddbb5396ca.tar.gz
bcm5719-llvm-2da7b8485248c27083318302c30462ddbb5396ca.zip
[lib/Fuzzer] when -sync_command=<CMD> is given, periodically execute 'CMD CORPUS' to synchronize with other processes
llvm-svn: 237617
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerInternal.h')
-rw-r--r--llvm/lib/Fuzzer/FuzzerInternal.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerInternal.h b/llvm/lib/Fuzzer/FuzzerInternal.h
index 89261895579..8d6193e9a22 100644
--- a/llvm/lib/Fuzzer/FuzzerInternal.h
+++ b/llvm/lib/Fuzzer/FuzzerInternal.h
@@ -43,6 +43,7 @@ void PrintASCII(const Unit &U, const char *PrintAfter = "");
std::string Hash(const Unit &U);
void SetTimer(int Seconds);
void PrintFileAsBase64(const std::string &Path);
+void ExecuteCommand(const std::string &Command);
// Private copy of SHA1 implementation.
static const int kSHA1NumBytes = 20;
@@ -66,7 +67,9 @@ class Fuzzer {
bool Reload = true;
int PreferSmallDuringInitialShuffle = -1;
size_t MaxNumberOfRuns = ULONG_MAX;
+ int SyncTimeout = 600;
std::string OutputCorpus;
+ std::string SyncCommand;
std::vector<std::string> Tokens;
};
Fuzzer(UserCallback Callback, FuzzingOptions Options);
@@ -108,6 +111,8 @@ class Fuzzer {
void PrintStats(const char *Where, size_t Cov, const char *End = "\n");
void PrintUnitInASCIIOrTokens(const Unit &U, const char *PrintAfter = "");
+ void SyncCorpus();
+
// Trace-based fuzzing: we run a unit with some kind of tracing
// enabled and record potentially useful mutations. Then
// We apply these mutations one by one to the unit and run it again.
@@ -142,6 +147,7 @@ class Fuzzer {
UserCallback Callback;
FuzzingOptions Options;
system_clock::time_point ProcessStartTime = system_clock::now();
+ system_clock::time_point LastExternalSync = system_clock::now();
system_clock::time_point UnitStartTime;
long TimeOfLongestUnitInSeconds = 0;
long EpochOfLastReadOfOutputCorpus = 0;
OpenPOWER on IntegriCloud