From: Bart Van Assche Date: Sun, 30 Mar 2008 13:28:33 +0000 (+0000) Subject: Modified mutex and condtion variable tracing output slightly. X-Git-Tag: svn/VALGRIND_3_4_0~774 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9c4b6537910dd32fcad341cee513d136093d6f72;p=thirdparty%2Fvalgrind.git Modified mutex and condtion variable tracing output slightly. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7821 --- diff --git a/exp-drd/drd_clientreq.c b/exp-drd/drd_clientreq.c index 84ce5a020d..839b3f7efa 100644 --- a/exp-drd/drd_clientreq.c +++ b/exp-drd/drd_clientreq.c @@ -66,7 +66,7 @@ static void drd_post_cond_wait(const Addr cond, 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 9d85676a7d..11e962fab5 100644 --- a/exp-drd/drd_cond.c +++ b/exp-drd/drd_cond.c @@ -116,7 +116,7 @@ void cond_pre_init(const Addr cond) 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 @@ void cond_post_destroy(const Addr cond) 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 @@ int cond_pre_wait(const Addr cond, const Addr mutex) 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 @@ int cond_post_wait(const Addr cond) 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 @@ void cond_pre_signal(Addr const cond) 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 @@ void cond_pre_broadcast(Addr const cond) 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 efcf6e60bb..6bd675b43e 100644 --- a/exp-drd/drd_main.c +++ b/exp-drd/drd_main.c @@ -651,7 +651,7 @@ void drd_pre_mutex_lock(const Addr mutex, const MutexT mutex_type, 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 5f275a0b31..c28487d4ab 100644 --- a/exp-drd/drd_mutex.c +++ b/exp-drd/drd_mutex.c @@ -249,7 +249,8 @@ void mutex_pre_lock(const Addr mutex, const MutexT mutex_type, * 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 @@ void mutex_post_lock(const Addr mutex, const Bool took_lock) 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 caabfb35ee..52880ffb64 100644 --- a/exp-drd/drd_mutex.h +++ b/exp-drd/drd_mutex.h @@ -46,7 +46,8 @@ void mutex_post_destroy(const Addr mutex); 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 d9c818f68b..dc5c9f5f81 100644 --- a/exp-drd/drd_semaphore.c +++ b/exp-drd/drd_semaphore.c @@ -117,7 +117,7 @@ struct semaphore_info* semaphore_init(const Addr semaphore, 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 @@ void semaphore_destroy(const Addr semaphore) 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 @@ void semaphore_pre_wait(const Addr semaphore) 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 @@ void semaphore_pre_post(const DrdThreadId tid, const Addr semaphore) 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 19944f296e..a43c281f7e 100644 --- a/exp-drd/tests/tc20_verifywrap2.stderr.exp +++ b/exp-drd/tests/tc20_verifywrap2.stderr.exp @@ -56,27 +56,27 @@ The object at address 0x........ is not a mutex. ---------------- 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 @@ Reader-writer lock not locked by calling thread: rwlock 0x......... ---------------- 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 8017f924ce..902270b2d0 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 @@ The object at address 0x........ is not a mutex. ---------------- 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 @@ Reader-writer lock not locked by calling thread: rwlock 0x......... ---------------- 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 e7226db2a6..8dca5324b3 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 @@ The object at address 0x........ is not a mutex. ---------------- 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 @@ Reader-writer lock not locked by calling thread: rwlock 0x......... ---------------- 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 ------------