sanitizer_common: fix deadlock detector output
authorDmitry Vyukov <dvyukov@google.com>
Tue, 26 Oct 2021 13:01:09 +0000 (15:01 +0200)
committerDmitry Vyukov <dvyukov@google.com>
Tue, 26 Oct 2021 14:11:52 +0000 (16:11 +0200)
Print PC of the previous lock, not the current one.
The current one will be printed during unwind.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D112533

compiler-rt/lib/sanitizer_common/sanitizer_mutex.cpp

index 1c177d8..40fe566 100644 (file)
@@ -174,7 +174,7 @@ struct InternalDeadlockDetector {
     if (max_idx != MutexInvalid && !mutex_can_lock[max_idx][type]) {
       Printf("%s: internal deadlock: can't lock %s under %s mutex\n", SanitizerToolName,
              mutex_meta[type].name, mutex_meta[max_idx].name);
-      PrintMutexPC(pc);
+      PrintMutexPC(locked[max_idx].pc);
       CHECK(0);
     }
     locked[type].seq = ++sequence;