Modified mutex and condtion variable tracing output slightly.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7821 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/exp-drd/drd_clientreq.c b/exp-drd/drd_clientreq.c
index 84ce5a0..839b3f7 100644
--- a/exp-drd/drd_clientreq.c
+++ b/exp-drd/drd_clientreq.c
@@ -66,7 +66,7 @@
const Bool took_lock)
{
cond_post_wait(cond);
- mutex_post_lock(mutex, took_lock);
+ mutex_post_lock(mutex, took_lock, True);
}
static void drd_pre_cond_signal(const Addr cond)
diff --git a/exp-drd/drd_cond.c b/exp-drd/drd_cond.c
index 9d85676..11e962f 100644
--- a/exp-drd/drd_cond.c
+++ b/exp-drd/drd_cond.c
@@ -116,7 +116,7 @@
if (s_trace_cond)
{
VG_(message)(Vg_UserMsg,
- "[%d/%d] cond_init 0x%lx",
+ "[%d/%d] cond_init cond 0x%lx",
VG_(get_running_tid)(),
thread_get_running_tid(),
cond);
@@ -145,7 +145,7 @@
if (s_trace_cond)
{
VG_(message)(Vg_UserMsg,
- "[%d/%d] cond_destroy 0x%lx",
+ "[%d/%d] cond_destroy cond 0x%lx",
VG_(get_running_tid)(),
thread_get_running_tid(),
cond);
@@ -185,7 +185,7 @@
if (s_trace_cond)
{
VG_(message)(Vg_UserMsg,
- "[%d/%d] cond_pre_wait 0x%lx",
+ "[%d/%d] cond_pre_wait cond 0x%lx",
VG_(get_running_tid)(),
thread_get_running_tid(),
cond);
@@ -216,7 +216,7 @@
if (s_trace_cond)
{
VG_(message)(Vg_UserMsg,
- "[%d/%d] cond_post_wait 0x%lx",
+ "[%d/%d] cond_post_wait cond 0x%lx",
VG_(get_running_tid)(),
thread_get_running_tid(),
cond);
@@ -272,7 +272,7 @@
if (s_trace_cond)
{
VG_(message)(Vg_UserMsg,
- "[%d/%d] cond_signal 0x%lx",
+ "[%d/%d] cond_signal cond 0x%lx",
VG_(get_running_tid)(),
thread_get_running_tid(),
cond);
@@ -287,7 +287,7 @@
if (s_trace_cond)
{
VG_(message)(Vg_UserMsg,
- "[%d/%d] cond_broadcast 0x%lx",
+ "[%d/%d] cond_broadcast cond 0x%lx",
VG_(get_running_tid)(),
thread_get_running_tid(),
cond);
diff --git a/exp-drd/drd_main.c b/exp-drd/drd_main.c
index efcf6e6..6bd675b 100644
--- a/exp-drd/drd_main.c
+++ b/exp-drd/drd_main.c
@@ -651,7 +651,7 @@
void drd_post_mutex_lock(const Addr mutex, const Bool took_lock)
{
- mutex_post_lock(mutex, took_lock);
+ mutex_post_lock(mutex, took_lock, False);
}
void drd_pre_mutex_unlock(const Addr mutex, const MutexT mutex_type)
diff --git a/exp-drd/drd_mutex.c b/exp-drd/drd_mutex.c
index 5f275a0..c28487d 100644
--- a/exp-drd/drd_mutex.c
+++ b/exp-drd/drd_mutex.c
@@ -249,7 +249,8 @@
* Note: this function must be called after pthread_mutex_lock() has been
* called, or a race condition is triggered !
*/
-void mutex_post_lock(const Addr mutex, const Bool took_lock)
+void mutex_post_lock(const Addr mutex, const Bool took_lock,
+ const Bool post_cond_wait)
{
const DrdThreadId drd_tid = thread_get_running_tid();
struct mutex_info* p;
@@ -259,9 +260,10 @@
if (s_trace_mutex)
{
VG_(message)(Vg_UserMsg,
- "[%d/%d] post_mutex_lock %s 0x%lx rc %d owner %d%s",
+ "[%d/%d] %s %s 0x%lx rc %d owner %d%s",
VG_(get_running_tid)(),
drd_tid,
+ post_cond_wait ? "cond_post_wait " : "post_mutex_lock",
p ? mutex_get_typename(p) : "(?)",
mutex,
p ? p->recursion_count : 0,
diff --git a/exp-drd/drd_mutex.h b/exp-drd/drd_mutex.h
index caabfb3..52880ff 100644
--- a/exp-drd/drd_mutex.h
+++ b/exp-drd/drd_mutex.h
@@ -46,7 +46,8 @@
struct mutex_info* mutex_get(const Addr mutex);
void mutex_pre_lock(const Addr mutex, const MutexT mutex_type,
const Bool trylock);
-void mutex_post_lock(const Addr mutex, const Bool took_lock);
+void mutex_post_lock(const Addr mutex, const Bool took_lock,
+ const Bool post_cond_wait);
void mutex_unlock(const Addr mutex, const MutexT mutex_type);
const char* mutex_get_typename(struct mutex_info* const p);
const char* mutex_type_name(const MutexT mt);
diff --git a/exp-drd/drd_semaphore.c b/exp-drd/drd_semaphore.c
index d9c818f..dc5c9f5 100644
--- a/exp-drd/drd_semaphore.c
+++ b/exp-drd/drd_semaphore.c
@@ -117,7 +117,7 @@
if (s_trace_semaphore)
{
VG_(message)(Vg_UserMsg,
- "[%d/%d] semaphore_init 0x%lx",
+ "[%d/%d] semaphore_init 0x%lx",
VG_(get_running_tid)(),
thread_get_running_tid(),
semaphore);
@@ -139,7 +139,7 @@
if (s_trace_semaphore)
{
VG_(message)(Vg_UserMsg,
- "[%d/%d] semaphore_destroy 0x%lx",
+ "[%d/%d] semaphore_destroy 0x%lx",
VG_(get_running_tid)(),
thread_get_running_tid(),
semaphore);
@@ -170,7 +170,7 @@
if (s_trace_semaphore)
{
VG_(message)(Vg_UserMsg,
- "[%d/%d] semaphore_pre_wait 0x%lx",
+ "[%d/%d] semaphore_pre_wait 0x%lx",
VG_(get_running_tid)(),
thread_get_running_tid(),
semaphore);
@@ -232,7 +232,7 @@
if (s_trace_semaphore)
{
VG_(message)(Vg_UserMsg,
- "[%d/%d] semaphore_post 0x%lx",
+ "[%d/%d] semaphore_post 0x%lx",
VG_(get_running_tid)(),
thread_get_running_tid(),
semaphore);
diff --git a/exp-drd/tests/tc20_verifywrap2.stderr.exp b/exp-drd/tests/tc20_verifywrap2.stderr.exp
index 19944f2..a43c281 100644
--- a/exp-drd/tests/tc20_verifywrap2.stderr.exp
+++ b/exp-drd/tests/tc20_verifywrap2.stderr.exp
@@ -56,27 +56,27 @@
---------------- pthread_cond_wait et al ----------------
[1/1] mutex_init error checking mutex 0x........
-[1/1] cond_init 0x........
+[1/1] cond_init cond 0x........
[1/1] mutex_unlock error checking mutex 0x........ rc 0
Mutex not locked: mutex 0x........, recursion count 0, owner 0.
at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:147)
-[1/1] cond_pre_wait 0x........
-[1/1] cond_post_wait 0x........
-[1/1] post_mutex_lock error checking mutex 0x........ rc 0 owner 0
-[1/1] cond_signal 0x........
+[1/1] cond_pre_wait cond 0x........
+[1/1] cond_post_wait cond 0x........
+[1/1] cond_post_wait error checking mutex 0x........ rc 0 owner 0
+[1/1] cond_signal cond 0x........
FIXME: can't figure out how to verify wrap of pthread_cond_signal
-[1/1] cond_broadcast 0x........
+[1/1] cond_broadcast cond 0x........
FIXME: can't figure out how to verify wrap of pthread_broadcast_signal
[1/1] mutex_unlock error checking mutex 0x........ rc 1
-[1/1] cond_pre_wait 0x........
-[1/1] cond_post_wait 0x........
-[1/1] post_mutex_lock error checking mutex 0x........ rc 0 owner 1
+[1/1] cond_pre_wait cond 0x........
+[1/1] cond_post_wait cond 0x........
+[1/1] cond_post_wait error checking mutex 0x........ rc 0 owner 1
---------------- pthread_rwlock_* ----------------
@@ -107,22 +107,22 @@
---------------- sem_* ----------------
-[1/1] semaphore_init 0x........
-[1/1] semaphore_init 0x........
+[1/1] semaphore_init 0x........
+[1/1] semaphore_init 0x........
FIXME: can't figure out how to verify wrap of sem_destroy
-[1/1] semaphore_pre_wait 0x........
+[1/1] semaphore_pre_wait 0x........
[1/1] semaphore_post_wait 0x........
Invalid semaphore: semaphore 0x........
at 0x........: sem_wait* (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:242)
-[1/1] semaphore_post 0x........
+[1/1] semaphore_post 0x........
FIXME: can't figure out how to verify wrap of sem_post
-[1/1] semaphore_destroy 0x........
+[1/1] semaphore_destroy 0x........
------------ dealloc of mem holding locks ------------
diff --git a/exp-drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3 b/exp-drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3
index 8017f92..902270b 100644
--- a/exp-drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3
+++ b/exp-drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3
@@ -53,27 +53,27 @@
---------------- pthread_cond_wait et al ----------------
[1/1] mutex_init error checking mutex 0x........
-[1/1] cond_init 0x........
+[1/1] cond_init cond 0x........
[1/1] mutex_unlock error checking mutex 0x........ rc 0
Mutex not locked: mutex 0x........, recursion count 0, owner 0.
at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:147)
-[1/1] cond_pre_wait 0x........
-[1/1] cond_post_wait 0x........
-[1/1] post_mutex_lock error checking mutex 0x........ rc 0 owner 0
-[1/1] cond_signal 0x........
+[1/1] cond_pre_wait cond 0x........
+[1/1] cond_post_wait cond 0x........
+[1/1] cond_post_wait error checking mutex 0x........ rc 0 owner 0
+[1/1] cond_signal cond 0x........
FIXME: can't figure out how to verify wrap of pthread_cond_signal
-[1/1] cond_broadcast 0x........
+[1/1] cond_broadcast cond 0x........
FIXME: can't figure out how to verify wrap of pthread_broadcast_signal
[1/1] mutex_unlock error checking mutex 0x........ rc 1
-[1/1] cond_pre_wait 0x........
-[1/1] cond_post_wait 0x........
-[1/1] post_mutex_lock error checking mutex 0x........ rc 0 owner 1
+[1/1] cond_pre_wait cond 0x........
+[1/1] cond_post_wait cond 0x........
+[1/1] cond_post_wait error checking mutex 0x........ rc 0 owner 1
---------------- pthread_rwlock_* ----------------
@@ -104,22 +104,22 @@
---------------- sem_* ----------------
-[1/1] semaphore_init 0x........
-[1/1] semaphore_init 0x........
+[1/1] semaphore_init 0x........
+[1/1] semaphore_init 0x........
FIXME: can't figure out how to verify wrap of sem_destroy
-[1/1] semaphore_pre_wait 0x........
+[1/1] semaphore_pre_wait 0x........
[1/1] semaphore_post_wait 0x........
Invalid semaphore: semaphore 0x........
at 0x........: sem_wait* (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:242)
-[1/1] semaphore_post 0x........
+[1/1] semaphore_post 0x........
FIXME: can't figure out how to verify wrap of sem_post
-[1/1] semaphore_destroy 0x........
+[1/1] semaphore_destroy 0x........
------------ dealloc of mem holding locks ------------
diff --git a/exp-drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3-b b/exp-drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3-b
index e7226db..8dca532 100644
--- a/exp-drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3-b
+++ b/exp-drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3-b
@@ -53,27 +53,27 @@
---------------- pthread_cond_wait et al ----------------
[1/1] mutex_init error checking mutex 0x........
-[1/1] cond_init 0x........
+[1/1] cond_init cond 0x........
[1/1] mutex_unlock error checking mutex 0x........ rc 0
Mutex not locked: mutex 0x........, recursion count 0, owner 0.
at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:147)
-[1/1] cond_pre_wait 0x........
-[1/1] cond_post_wait 0x........
-[1/1] post_mutex_lock error checking mutex 0x........ rc 0 owner 0
-[1/1] cond_signal 0x........
+[1/1] cond_pre_wait cond 0x........
+[1/1] cond_post_wait cond 0x........
+[1/1] cond_post_wait error checking mutex 0x........ rc 0 owner 0
+[1/1] cond_signal cond 0x........
FIXME: can't figure out how to verify wrap of pthread_cond_signal
-[1/1] cond_broadcast 0x........
+[1/1] cond_broadcast cond 0x........
FIXME: can't figure out how to verify wrap of pthread_broadcast_signal
[1/1] mutex_unlock error checking mutex 0x........ rc 1
-[1/1] cond_pre_wait 0x........
-[1/1] cond_post_wait 0x........
-[1/1] post_mutex_lock error checking mutex 0x........ rc 0 owner 1
+[1/1] cond_pre_wait cond 0x........
+[1/1] cond_post_wait cond 0x........
+[1/1] cond_post_wait error checking mutex 0x........ rc 0 owner 1
---------------- pthread_rwlock_* ----------------
@@ -104,22 +104,22 @@
---------------- sem_* ----------------
-[1/1] semaphore_init 0x........
-[1/1] semaphore_init 0x........
+[1/1] semaphore_init 0x........
+[1/1] semaphore_init 0x........
FIXME: can't figure out how to verify wrap of sem_destroy
-[1/1] semaphore_pre_wait 0x........
+[1/1] semaphore_pre_wait 0x........
[1/1] semaphore_post_wait 0x........
Invalid semaphore: semaphore 0x........
at 0x........: sem_wait* (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:242)
-[1/1] semaphore_post 0x........
+[1/1] semaphore_post 0x........
FIXME: can't figure out how to verify wrap of sem_post
-[1/1] semaphore_destroy 0x........
+[1/1] semaphore_destroy 0x........
------------ dealloc of mem holding locks ------------