1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

[libFuzzer] don't print large artifacts to stderr

llvm-svn: 249808
This commit is contained in:
Kostya Serebryany 2015-10-09 04:03:14 +00:00
parent e3d637a4af
commit 98ed53705f

View File

@ -48,8 +48,10 @@ void Fuzzer::StaticDeathCallback() {
void Fuzzer::DeathCallback() {
Printf("DEATH:\n");
Print(CurrentUnit, "\n");
PrintUnitInASCIIOrTokens(CurrentUnit, "\n");
if (CurrentUnit.size() <= kMaxUnitSizeToPrint) {
Print(CurrentUnit, "\n");
PrintUnitInASCIIOrTokens(CurrentUnit, "\n");
}
WriteUnitToFileWithPrefix(CurrentUnit, "crash-");
}
@ -69,9 +71,10 @@ void Fuzzer::AlarmCallback() {
Printf("ALARM: working on the last Unit for %zd seconds\n", Seconds);
Printf(" and the timeout value is %d (use -timeout=N to change)\n",
Options.UnitTimeoutSec);
if (CurrentUnit.size() <= kMaxUnitSizeToPrint)
if (CurrentUnit.size() <= kMaxUnitSizeToPrint) {
Print(CurrentUnit, "\n");
PrintUnitInASCIIOrTokens(CurrentUnit, "\n");
PrintUnitInASCIIOrTokens(CurrentUnit, "\n");
}
WriteUnitToFileWithPrefix(CurrentUnit, "timeout-");
exit(1);
}
@ -164,8 +167,6 @@ size_t Fuzzer::RunOne(const Unit &U) {
TimeOfUnit >= Options.ReportSlowUnits) {
TimeOfLongestUnitInSeconds = TimeOfUnit;
Printf("Slowest unit: %zd s:\n", TimeOfLongestUnitInSeconds);
if (U.size() <= kMaxUnitSizeToPrint)
Print(U, "\n");
WriteUnitToFileWithPrefix(U, "slow-unit-");
}
return Res;