diff options
author | Kostya Serebryany <kcc@google.com> | 2014-05-12 08:01:51 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2014-05-12 08:01:51 +0000 |
commit | f19b9748325376109a89218554c4dc17264e779a (patch) | |
tree | f8a6ef1429386aa621865d17fd621261ac039116 | |
parent | 89f2232fb0cb73749086459676fa149b6ac54092 (diff) |
[asan] fix a self deadlock when printing stats; add a relevant test, cleanup that test while at it to remove linux/darwin differences. Fixes http://code.google.com/p/address-sanitizer/issues/detail?id=306
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208525 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/asan/asan_report.cc | 2 | ||||
-rw-r--r-- | test/asan/TestCases/heap-overflow.cc | 16 |
2 files changed, 8 insertions, 10 deletions
diff --git a/lib/asan/asan_report.cc b/lib/asan/asan_report.cc index af6f77053..8a3259366 100644 --- a/lib/asan/asan_report.cc +++ b/lib/asan/asan_report.cc @@ -557,6 +557,8 @@ class ScopedInErrorReport { NORETURN ~ScopedInErrorReport() { // Make sure the current thread is announced. DescribeThread(GetCurrentThread()); + // We may want to grab this lock again when printing stats. + asanThreadRegistry().Unlock(); // Print memory stats. if (flags()->print_stats) __asan_print_accumulated_stats(); diff --git a/test/asan/TestCases/heap-overflow.cc b/test/asan/TestCases/heap-overflow.cc index 6b49c0955..1a5098a34 100644 --- a/test/asan/TestCases/heap-overflow.cc +++ b/test/asan/TestCases/heap-overflow.cc @@ -1,8 +1,8 @@ -// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK -// RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK -// RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK -// RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK - +// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: ASAN_OPTIONS=print_stats=1 not %run %t 2>&1 | FileCheck %s #include <stdlib.h> #include <string.h> int main(int argc, char **argv) { @@ -14,11 +14,7 @@ int main(int argc, char **argv) { // CHECK: {{0x.* is located 0 bytes to the right of 10-byte region}} // CHECK: {{allocated by thread T0 here:}} - // CHECK-Linux: {{ #0 0x.* in .*malloc}} - // CHECK-Linux: {{ #1 0x.* in main .*heap-overflow.cc:9}} - - // CHECK-Darwin: {{ #0 0x.* in wrap_malloc.*}} - // CHECK-Darwin: {{ #1 0x.* in main .*heap-overflow.cc:9}} + // CHECK: {{ #0 0x.* in .*malloc}} free(x); return res; } |