diff options
| author | Kostya Serebryany <kcc@google.com> | 2014-03-18 05:56:14 +0000 |
|---|---|---|
| committer | Kostya Serebryany <kcc@google.com> | 2014-03-18 05:56:14 +0000 |
| commit | 5c0171b811c997de7180c7df24b3ae609946a828 (patch) | |
| tree | cd61ea6afe6a03dbcef9b9e19012b3940399da7e | |
| parent | 42b233a836ebda7c725426ff0c8d9e68dc9c9933 (diff) | |
| download | bcm5719-llvm-5c0171b811c997de7180c7df24b3ae609946a828.tar.gz bcm5719-llvm-5c0171b811c997de7180c7df24b3ae609946a828.zip | |
[sanitizer] a bit more informative deadlock detector report (still lots to improve)
llvm-svn: 204115
| -rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_report.cc | 24 | ||||
| -rw-r--r-- | compiler-rt/test/tsan/deadlock_detector_stress_test.cc | 4 |
2 files changed, 18 insertions, 10 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_report.cc b/compiler-rt/lib/tsan/rtl/tsan_report.cc index 5281c7ae973..996981f0484 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_report.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_report.cc @@ -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++) diff --git a/compiler-rt/test/tsan/deadlock_detector_stress_test.cc b/compiler-rt/test/tsan/deadlock_detector_stress_test.cc index 19a9bb920a3..a4555a9a3a8 100644 --- a/compiler-rt/test/tsan/deadlock_detector_stress_test.cc +++ b/compiler-rt/test/tsan/deadlock_detector_stress_test.cc @@ -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: |

