diff options
author | Alexey Samsonov <vonosmas@gmail.com> | 2016-02-12 20:20:51 +0000 |
---|---|---|
committer | Alexey Samsonov <vonosmas@gmail.com> | 2016-02-12 20:20:51 +0000 |
commit | eb649bcfb91e97920f488837db7b447f1eef3d1a (patch) | |
tree | 59846b1f0dbcfef0b551a326f83d4ee04ae9a946 | |
parent | 7b3ef05a37fef2f805d31f498d30198ddeeb1a0c (diff) | |
download | bcm5719-llvm-eb649bcfb91e97920f488837db7b447f1eef3d1a.tar.gz bcm5719-llvm-eb649bcfb91e97920f488837db7b447f1eef3d1a.zip |
[LSan] Print more helpful error message if LSan crashes during leak detection.
llvm-svn: 260717
-rw-r--r-- | compiler-rt/lib/lsan/lsan_common.cc | 3 | ||||
-rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc | 4 | ||||
-rw-r--r-- | compiler-rt/test/asan/TestCases/Linux/leak_check_segv.cc | 6 |
3 files changed, 8 insertions, 5 deletions
diff --git a/compiler-rt/lib/lsan/lsan_common.cc b/compiler-rt/lib/lsan/lsan_common.cc index e88853cab05..58ccab58cdb 100644 --- a/compiler-rt/lib/lsan/lsan_common.cc +++ b/compiler-rt/lib/lsan/lsan_common.cc @@ -446,6 +446,9 @@ static bool CheckForLeaks() { if (!param.success) { Report("LeakSanitizer has encountered a fatal error.\n"); + Report( + "HINT: For debugging, try setting environment variable " + "LSAN_OPTIONS=verbosity=1:log_threads=1\n"); Die(); } param.leak_report.ApplySuppressions(); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc index 2376ee56e1d..80a70979c9b 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc @@ -229,8 +229,8 @@ static void TracerThreadDieCallback() { // Signal handler to wake up suspended threads when the tracer thread dies. static void TracerThreadSignalHandler(int signum, void *siginfo, void *uctx) { SignalContext ctx = SignalContext::Create(siginfo, uctx); - VPrintf(1, "Tracer caught signal %d: addr=0x%zx pc=0x%zx sp=0x%zx\n", - signum, ctx.addr, ctx.pc, ctx.sp); + Printf("Tracer caught signal %d: addr=0x%zx pc=0x%zx sp=0x%zx\n", signum, + ctx.addr, ctx.pc, ctx.sp); ThreadSuspender *inst = thread_suspender_instance; if (inst) { if (signum == SIGABRT) diff --git a/compiler-rt/test/asan/TestCases/Linux/leak_check_segv.cc b/compiler-rt/test/asan/TestCases/Linux/leak_check_segv.cc index 8160d5fe56b..2a2010f7ab0 100644 --- a/compiler-rt/test/asan/TestCases/Linux/leak_check_segv.cc +++ b/compiler-rt/test/asan/TestCases/Linux/leak_check_segv.cc @@ -1,5 +1,5 @@ // Test that SIGSEGV during leak checking does not crash the process. -// RUN: %clangxx_asan -O1 %s -o %t && LSAN_OPTIONS="verbosity=1" not %run %t 2>&1 +// RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s // REQUIRES: leak-detection #include <stdlib.h> #include <stdio.h> @@ -11,7 +11,7 @@ char data[10 * 1024 * 1024]; int main() { void *p = malloc(10 * 1024 * 1024); // surprise-surprise! - mprotect((void*)(((unsigned long)p + 4095) & ~4095), 16 * 1024, PROT_NONE); + mprotect((void*)(((unsigned long)p + 4095) & ~4095), 16 * 1024, PROT_NONE); mprotect((void*)(((unsigned long)data + 4095) & ~4095), 16 * 1024, PROT_NONE); __lsan_do_leak_check(); fprintf(stderr, "DONE\n"); @@ -19,5 +19,5 @@ int main() { // CHECK: Tracer caught signal 11 // CHECK: LeakSanitizer has encountered a fatal error +// CHECK: HINT: For debugging, try setting {{.*}} LSAN_OPTIONS // CHECK-NOT: DONE - |