From f01c094cddfff1c5a139fc4a822c552586f5a1e6 Mon Sep 17 00:00:00 2001 From: Kostya Serebryany Date: Mon, 17 Mar 2014 14:56:04 +0000 Subject: [PATCH] [sanitizer] reverse the order of the stack traces printed for every pair of locks in the deadlock report (first print the 'from' node, then print the 'to' node of the deadlock graph) llvm-svn: 204043 --- .../lib/sanitizer_common/sanitizer_deadlock_detector.h | 4 ++-- compiler-rt/test/tsan/deadlock_detector_stress_test.cc | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h b/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h index a75612a032fb..637153c90a29 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h @@ -231,8 +231,8 @@ class DeadlockDetector { added_edges, ARRAY_SIZE(added_edges)); for (uptr i = 0; i < n_added_edges; i++) { if (n_edges_ < ARRAY_SIZE(edges_)) - edges_[n_edges_++] = Edge((u16)added_edges[i], (u16)cur_idx, stk, - dtls->findLockContext(added_edges[i])); + edges_[n_edges_++] = Edge((u16)added_edges[i], (u16)cur_idx, + dtls->findLockContext(added_edges[i]), stk); // Printf("Edge [%zd]: %u %zd=>%zd\n", i, stk, added_edges[i], cur_idx); } return n_added_edges; diff --git a/compiler-rt/test/tsan/deadlock_detector_stress_test.cc b/compiler-rt/test/tsan/deadlock_detector_stress_test.cc index a85c2e891ff5..19a9bb920a35 100644 --- a/compiler-rt/test/tsan/deadlock_detector_stress_test.cc +++ b/compiler-rt/test/tsan/deadlock_detector_stress_test.cc @@ -417,13 +417,13 @@ class LockTest { fprintf(stderr, "Starting Test16: detailed output test with two locks\n"); // CHECK: Starting Test16 // CHECK: WARNING: ThreadSanitizer: lock-order-inversion + // CHECK: LockTest::Acquire0 + // CHECK-NEXT: LockTest::Acquire_0_then_1 // CHECK: LockTest::Acquire1 // CHECK-NEXT: LockTest::Acquire_0_then_1 - // CHECK: LockTest::Acquire0 - // CHECK-NEXT: LockTest::Acquire_0_then_1 - // CHECK: LockTest::Acquire0 + // CHECK: LockTest::Acquire1 // CHECK-NEXT: LockTest::Acquire_1_then_0 - // CHECK: LockTest::Acquire1 + // CHECK: LockTest::Acquire0 // CHECK-NEXT: LockTest::Acquire_1_then_0 Init(5); Acquire_0_then_1();