aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Fuzzer/FuzzerLoop.cpp
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/lib/Fuzzer/FuzzerLoop.cpp
parent5725756791452eb91e23e37cb9958687771cb10a (diff)
downloadllvm-f6414426f2fbdd20ba59dfe5379783bf746c85ff.zip
llvm-f6414426f2fbdd20ba59dfe5379783bf746c85ff.tar.gz
llvm-f6414426f2fbdd20ba59dfe5379783bf746c85ff.tar.bz2
[libFuzzer] use __sanitizer_print_memory_profile to print the memory profile on OOM
llvm-svn: 271465
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerLoop.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerLoop.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp
index f615642..357f150 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();