[llvm] r243031 - [libFuzzer] dump long running units to disk
Kostya Serebryany
kcc at google.com
Thu Jul 23 11:37:22 PDT 2015
Author: kcc
Date: Thu Jul 23 13:37:22 2015
New Revision: 243031
URL: http://llvm.org/viewvc/llvm-project?rev=243031&view=rev
Log:
[libFuzzer] dump long running units to disk
Modified:
llvm/trunk/lib/Fuzzer/FuzzerInternal.h
llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
llvm/trunk/lib/Fuzzer/test/fuzzer.test
Modified: llvm/trunk/lib/Fuzzer/FuzzerInternal.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerInternal.h?rev=243031&r1=243030&r2=243031&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerInternal.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerInternal.h Thu Jul 23 13:37:22 2015
@@ -108,7 +108,7 @@ class Fuzzer {
size_t RunOneMaximizeFullCoverageSet(const Unit &U);
size_t RunOneMaximizeCoveragePairs(const Unit &U);
void WriteToOutputCorpus(const Unit &U);
- void WriteToCrash(const Unit &U, const char *Prefix);
+ void WriteUnitToFileWithPrefix(const Unit &U, const char *Prefix);
void PrintStats(const char *Where, size_t Cov, const char *End = "\n");
void PrintUnitInASCIIOrTokens(const Unit &U, const char *PrintAfter = "");
Modified: llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp?rev=243031&r1=243030&r2=243031&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp Thu Jul 23 13:37:22 2015
@@ -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 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);
}
Modified: llvm/trunk/lib/Fuzzer/test/fuzzer.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/fuzzer.test?rev=243031&r1=243030&r2=243031&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/fuzzer.test (original)
+++ llvm/trunk/lib/Fuzzer/test/fuzzer.test Thu Jul 23 13:37:22 2015
@@ -4,14 +4,14 @@ RUN: LLVMFuzzer-SimpleTest 2>&1 | FileCh
RUN: not LLVMFuzzer-InfiniteTest -timeout=2 2>&1 | FileCheck %s --check-prefix=InfiniteTest
InfiniteTest: ALARM: working on the last Unit for
-InfiniteTest: CRASHED; file written to timeout
+InfiniteTest: Test unit written to timeout-
RUN: not LLVMFuzzer-TimeoutTest -timeout=5 2>&1 | FileCheck %s --check-prefix=TimeoutTest
TimeoutTest: ALARM: working on the last Unit for
-TimeoutTest: CRASHED; file written to timeout
+TimeoutTest: Test unit written to timeout-
RUN: not LLVMFuzzer-NullDerefTest 2>&1 | FileCheck %s --check-prefix=NullDerefTest
-NullDerefTest: CRASHED; file written to crash-
+NullDerefTest: Test unit written to crash-
RUN: not LLVMFuzzer-FullCoverageSetTest -timeout=15 -seed=1 -mutate_depth=2 -use_full_coverage_set=1 2>&1 | FileCheck %s
More information about the llvm-commits
mailing list