[compiler-rt] r204115 - [sanitizer] a bit more informative deadlock detector report (still lots to improve)
Kostya Serebryany
kcc at google.com
Mon Mar 17 22:56:15 PDT 2014
Author: kcc
Date: Tue Mar 18 00:56:14 2014
New Revision: 204115
URL: http://llvm.org/viewvc/llvm-project?rev=204115&view=rev
Log:
[sanitizer] a bit more informative deadlock detector report (still lots to improve)
Modified:
compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc
compiler-rt/trunk/test/tsan/deadlock_detector_stress_test.cc
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc?rev=204115&r1=204114&r2=204115&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc Tue Mar 18 00:56:14 2014
@@ -231,17 +231,25 @@ void PrintReport(const ReportDesc *rep)
Printf("%s", d.EndWarning());
if (rep->typ == ReportTypeDeadlock) {
- Printf(" path: ");
+ Printf(" Path: ");
CHECK_GT(rep->mutexes.Size(), 0U);
+ CHECK_EQ(rep->mutexes.Size() * 2, rep->stacks.Size());
for (uptr i = 0; i < rep->mutexes.Size(); i++)
PrintMutexShort(rep->mutexes[i], " => ");
- PrintMutexShort(rep->mutexes[0], "\n");
- }
-
- for (uptr i = 0; i < rep->stacks.Size(); i++) {
- if (i)
- Printf(" and:\n");
- PrintStack(rep->stacks[i]);
+ PrintMutexShort(rep->mutexes[0], "\n\n");
+ for (uptr i = 0; i < rep->mutexes.Size(); i++) {
+ Printf(" Edge: ");
+ PrintMutexShort(rep->mutexes[i], " => ");
+ PrintMutexShort(rep->mutexes[(i+1) % rep->mutexes.Size()], "\n");
+ PrintStack(rep->stacks[2*i]);
+ PrintStack(rep->stacks[2*i+1]);
+ }
+ } else {
+ for (uptr i = 0; i < rep->stacks.Size(); i++) {
+ if (i)
+ Printf(" and:\n");
+ PrintStack(rep->stacks[i]);
+ }
}
for (uptr i = 0; i < rep->mops.Size(); i++)
Modified: compiler-rt/trunk/test/tsan/deadlock_detector_stress_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/deadlock_detector_stress_test.cc?rev=204115&r1=204114&r2=204115&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/deadlock_detector_stress_test.cc (original)
+++ compiler-rt/trunk/test/tsan/deadlock_detector_stress_test.cc Tue Mar 18 00:56:14 2014
@@ -151,7 +151,7 @@ class LockTest {
Lock_0_1();
Lock_1_0();
// CHECK: WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock)
- // CHECK: path: [[M1:M[0-9]+]] => [[M2:M[0-9]+]] => [[M1]]
+ // CHECK: Path: [[M1:M[0-9]+]] => [[M2:M[0-9]+]] => [[M1]]
// CHECK: Mutex [[M1]] ([[A1]]) created at:
// CHECK: Mutex [[M2]] ([[A2]]) created at:
// CHECK-NOT: WARNING: ThreadSanitizer:
@@ -169,7 +169,7 @@ class LockTest {
Lock2(1, 2);
Lock2(2, 0);
// CHECK: WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock)
- // CHECK: path: [[M1:M[0-9]+]] => [[M2:M[0-9]+]] => [[M3:M[0-9]+]] => [[M1]]
+ // CHECK: Path: [[M1:M[0-9]+]] => [[M2:M[0-9]+]] => [[M3:M[0-9]+]] => [[M1]]
// CHECK: Mutex [[M1]] ([[A1]]) created at:
// CHECK: Mutex [[M2]] ([[A2]]) created at:
// CHECK: Mutex [[M3]] ([[A3]]) created at:
More information about the llvm-commits
mailing list