[compiler-rt] r191151 - tsan: improve diagnostics for incorrect usages of mutexes
Dmitry Vyukov
dvyukov at google.com
Sat Sep 21 15:43:27 PDT 2013
Author: dvyukov
Date: Sat Sep 21 17:43:27 2013
New Revision: 191151
URL: http://llvm.org/viewvc/llvm-project?rev=191151&view=rev
Log:
tsan: improve diagnostics for incorrect usages of mutexes
Modified:
compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_mutex.cc
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_mutex.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_mutex.cc?rev=191151&r1=191150&r2=191151&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_mutex.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_mutex.cc Sat Sep 21 17:43:27 2013
@@ -95,7 +95,7 @@ void MutexLock(ThreadState *thr, uptr pc
} else if (s->owner_tid == thr->tid) {
CHECK_GT(s->recursion, 0);
} else {
- Printf("ThreadSanitizer WARNING: double lock\n");
+ Printf("ThreadSanitizer WARNING: double lock of mutex %p\n", addr);
PrintCurrentStack(thr, pc);
}
if (s->recursion == 0) {
@@ -125,13 +125,14 @@ int MutexUnlock(ThreadState *thr, uptr p
if (s->recursion == 0) {
if (!s->is_broken) {
s->is_broken = true;
- Printf("ThreadSanitizer WARNING: unlock of unlocked mutex\n");
+ Printf("ThreadSanitizer WARNING: unlock of unlocked mutex %p\n", addr);
PrintCurrentStack(thr, pc);
}
} else if (s->owner_tid != thr->tid) {
if (!s->is_broken) {
s->is_broken = true;
- Printf("ThreadSanitizer WARNING: mutex unlock by another thread\n");
+ Printf("ThreadSanitizer WARNING: mutex %p is unlocked by wrong thread\n",
+ addr);
PrintCurrentStack(thr, pc);
}
} else {
@@ -163,7 +164,8 @@ void MutexReadLock(ThreadState *thr, upt
thr->fast_state.IncrementEpoch();
TraceAddEvent(thr, thr->fast_state, EventTypeRLock, s->GetId());
if (s->owner_tid != SyncVar::kInvalidTid) {
- Printf("ThreadSanitizer WARNING: read lock of a write locked mutex\n");
+ Printf("ThreadSanitizer WARNING: read lock of a write locked mutex %p\n",
+ addr);
PrintCurrentStack(thr, pc);
}
thr->clock.set(thr->tid, thr->fast_state.epoch());
@@ -184,8 +186,8 @@ void MutexReadUnlock(ThreadState *thr, u
thr->fast_state.IncrementEpoch();
TraceAddEvent(thr, thr->fast_state, EventTypeRUnlock, s->GetId());
if (s->owner_tid != SyncVar::kInvalidTid) {
- Printf("ThreadSanitizer WARNING: read unlock of a write "
- "locked mutex\n");
+ Printf("ThreadSanitizer WARNING: read unlock of a write locked mutex %p\n",
+ addr);
PrintCurrentStack(thr, pc);
}
thr->clock.set(thr->tid, thr->fast_state.epoch());
@@ -235,7 +237,8 @@ void MutexReadOrWriteUnlock(ThreadState
}
} else if (!s->is_broken) {
s->is_broken = true;
- Printf("ThreadSanitizer WARNING: mutex unlock by another thread\n");
+ Printf("ThreadSanitizer WARNING: mutex %p is unlock by wrong thread\n",
+ addr);
PrintCurrentStack(thr, pc);
}
thr->mset.Del(s->GetId(), write);
More information about the llvm-commits
mailing list