forked from OSchip/llvm-project
[LSan] Print more helpful error message if LSan crashes during leak detection.
llvm-svn: 260717
This commit is contained in:
parent
7b3ef05a37
commit
eb649bcfb9
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue