summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2016-06-02 01:33:11 +0000
committerKostya Serebryany <kcc@google.com>2016-06-02 01:33:11 +0000
commitf6414426f2fbdd20ba59dfe5379783bf746c85ff (patch)
tree5c93775209f5c434d9c7cb644a7153b779dc1462 /llvm
parent5725756791452eb91e23e37cb9958687771cb10a (diff)
downloadbcm5719-llvm-f6414426f2fbdd20ba59dfe5379783bf746c85ff.tar.gz
bcm5719-llvm-f6414426f2fbdd20ba59dfe5379783bf746c85ff.zip
[libFuzzer] use __sanitizer_print_memory_profile to print the memory profile on OOM
llvm-svn: 271465
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Fuzzer/FuzzerLoop.cpp5
-rw-r--r--llvm/lib/Fuzzer/test/fuzzer-oom.test1
2 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp
index f615642d32c..357f1505c89 100644
--- a/llvm/lib/Fuzzer/FuzzerLoop.cpp
+++ b/llvm/lib/Fuzzer/FuzzerLoop.cpp
@@ -55,6 +55,7 @@ __attribute__((weak)) void __sanitizer_free_hook(void *ptr);
__attribute__((weak)) void __lsan_enable();
__attribute__((weak)) void __lsan_disable();
__attribute__((weak)) int __lsan_do_recoverable_leak_check();
+__attribute__((weak)) int __sanitizer_print_memory_profile(size_t);
}
namespace fuzzer {
@@ -256,7 +257,9 @@ void Fuzzer::RssLimitCallback() {
Printf(
"==%d== ERROR: libFuzzer: out-of-memory (used: %zdMb; limit: %zdMb)\n",
GetPid(), GetPeakRSSMb(), Options.RssLimitMb);
- Printf(" To change the out-of-memory limit use -rss_limit_mb=<N>\n");
+ Printf(" To change the out-of-memory limit use -rss_limit_mb=<N>\n\n");
+ if (__sanitizer_print_memory_profile)
+ __sanitizer_print_memory_profile(50);
DumpCurrentUnit("oom-");
Printf("SUMMARY: libFuzzer: out-of-memory\n");
PrintFinalStats();
diff --git a/llvm/lib/Fuzzer/test/fuzzer-oom.test b/llvm/lib/Fuzzer/test/fuzzer-oom.test
index 4cdff2142fd..4eeaef4c057 100644
--- a/llvm/lib/Fuzzer/test/fuzzer-oom.test
+++ b/llvm/lib/Fuzzer/test/fuzzer-oom.test
@@ -1,4 +1,5 @@
RUN: not LLVMFuzzer-OutOfMemoryTest -rss_limit_mb=10 2>&1 | FileCheck %s
CHECK: ERROR: libFuzzer: out-of-memory (used: {{.*}}; limit: 10Mb)
+CHECK: Live Heap Allocations
CHECK: Test unit written to ./oom-
SUMMARY: libFuzzer: out-of-memory
OpenPOWER on IntegriCloud