summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerLoop.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-10-16 23:04:31 +0000
committerKostya Serebryany <kcc@google.com>2015-10-16 23:04:31 +0000
commitd6edce97fb762b69f6f63c456b764c25386f7543 (patch)
tree294cff515f7d09553c33516698cc6967dbe94d97 /llvm/lib/Fuzzer/FuzzerLoop.cpp
parentb43d33bf0fee62317cc24239c77ae0f05fdb40f2 (diff)
downloadbcm5719-llvm-d6edce97fb762b69f6f63c456b764c25386f7543.tar.gz
bcm5719-llvm-d6edce97fb762b69f6f63c456b764c25386f7543.zip
[libFuzzer] print a stack trace on timeout
llvm-svn: 250571
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerLoop.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerLoop.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp
index 93054298bc4..a642bbbf5cb 100644
--- a/llvm/lib/Fuzzer/FuzzerLoop.cpp
+++ b/llvm/lib/Fuzzer/FuzzerLoop.cpp
@@ -13,6 +13,10 @@
#include <sanitizer/coverage_interface.h>
#include <algorithm>
+extern "C" {
+__attribute__((weak)) void __sanitizer_print_stack_trace();
+}
+
namespace fuzzer {
static const size_t kMaxUnitSizeToPrint = 256;
@@ -76,6 +80,11 @@ void Fuzzer::AlarmCallback() {
PrintUnitInASCIIOrTokens(CurrentUnit, "\n");
}
WriteUnitToFileWithPrefix(CurrentUnit, "timeout-");
+ Printf("==%d== ERROR: libFuzzer: timeout after %d seconds\n", GetPid(),
+ Seconds);
+ if (__sanitizer_print_stack_trace)
+ __sanitizer_print_stack_trace();
+ Printf("SUMMARY: libFuzzer: timeout\n");
exit(1);
}
}
OpenPOWER on IntegriCloud