summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerLoop.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-07-23 18:37:22 +0000
committerKostya Serebryany <kcc@google.com>2015-07-23 18:37:22 +0000
commit2b7d2e91ccbc091c8e447919d7d81f1bced8aa7f (patch)
tree5a49cd924ef27ed82bca9c9a73f781eac5c29060 /llvm/lib/Fuzzer/FuzzerLoop.cpp
parent983d17810811cdac0ff475049451f48a6da5cb25 (diff)
downloadbcm5719-llvm-2b7d2e91ccbc091c8e447919d7d81f1bced8aa7f.tar.gz
bcm5719-llvm-2b7d2e91ccbc091c8e447919d7d81f1bced8aa7f.zip
[libFuzzer] dump long running units to disk
llvm-svn: 243031
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerLoop.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerLoop.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp
index 9ef47583cbb..d6533910f00 100644
--- a/llvm/lib/Fuzzer/FuzzerLoop.cpp
+++ b/llvm/lib/Fuzzer/FuzzerLoop.cpp
@@ -49,7 +49,7 @@ void Fuzzer::DeathCallback() {
Printf("DEATH:\n");
Print(CurrentUnit, "\n");
PrintUnitInASCIIOrTokens(CurrentUnit, "\n");
- WriteToCrash(CurrentUnit, "crash-");
+ WriteUnitToFileWithPrefix(CurrentUnit, "crash-");
}
void Fuzzer::StaticAlarmCallback() {
@@ -70,7 +70,7 @@ void Fuzzer::AlarmCallback() {
Options.UnitTimeoutSec);
Print(CurrentUnit, "\n");
PrintUnitInASCIIOrTokens(CurrentUnit, "\n");
- WriteToCrash(CurrentUnit, "timeout-");
+ WriteUnitToFileWithPrefix(CurrentUnit, "timeout-");
exit(1);
}
}
@@ -161,6 +161,7 @@ size_t Fuzzer::RunOne(const Unit &U) {
TimeOfLongestUnitInSeconds = TimeOfUnit;
Printf("Longest unit: %zd s:\n", TimeOfLongestUnitInSeconds);
Print(U, "\n");
+ WriteUnitToFileWithPrefix(U, "long-running-unit-");
}
return Res;
}
@@ -248,10 +249,10 @@ void Fuzzer::WriteToOutputCorpus(const Unit &U) {
Printf("Written to %s\n", Path.c_str());
}
-void Fuzzer::WriteToCrash(const Unit &U, const char *Prefix) {
+void Fuzzer::WriteUnitToFileWithPrefix(const Unit &U, const char *Prefix) {
std::string Path = Prefix + Hash(U);
WriteToFile(U, Path);
- Printf("CRASHED; file written to %s\nBase64: ", Path.c_str());
+ Printf("Test unit written to %s\nBase64: ", Path.c_str());
PrintFileAsBase64(Path);
}
OpenPOWER on IntegriCloud