From: Bart Van Assche Date: Wed, 27 Feb 2008 15:46:00 +0000 (+0000) Subject: Modified drd client requests such that the mutex type can be passed from the intercep... X-Git-Tag: svn/VALGRIND_3_4_0~1020 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0336cdffbbe98415f4fa3bb2bff6abac39ed1b6a;p=thirdparty%2Fvalgrind.git Modified drd client requests such that the mutex type can be passed from the intercepts to the tool. An error message is now printed in case a locked mutex is destroyed and in case a thread exits while it holds a lock on a mutex. Changed format of mutex error messages. Added recursive_mutex regression test. Fixed autogen warnings in exp-drd/tests/Makefile.am. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7489 --- diff --git a/exp-drd/drd_clientreq.c b/exp-drd/drd_clientreq.c index a3d5287ffd..8d35dd1710 100644 --- a/exp-drd/drd_clientreq.c +++ b/exp-drd/drd_clientreq.c @@ -54,17 +54,17 @@ static void drd_spin_init_or_unlock(const Addr spinlock, const SizeT size) } static void drd_pre_cond_wait(const Addr cond, const SizeT cond_size, - const Addr mutex) + const Addr mutex, const MutexT mutex_type) { - mutex_unlock(mutex, mutex_type_mutex); + mutex_unlock(mutex, mutex_type); cond_pre_wait(cond, cond_size, mutex); } static void drd_post_cond_wait(const Addr cond, const Addr mutex, - const SizeT size) + const SizeT size, const MutexT mutex_type) { cond_post_wait(cond); - mutex_lock(mutex, size, mutex_type_mutex); + mutex_lock(mutex, size, mutex_type); } static void drd_pre_cond_signal(const Addr cond) @@ -164,12 +164,13 @@ static Bool drd_handle_client_request(ThreadId tid, UWord* arg, UWord* ret) break; case VG_USERREQ__PRE_PTHREAD_COND_WAIT: - drd_pre_cond_wait(arg[1]/*cond*/, arg[2]/*cond_size*/, arg[3]/*mutex*/); + drd_pre_cond_wait(arg[1]/*cond*/, arg[2]/*cond_size*/, + arg[3]/*mutex*/, arg[4]/*mutex_type*/); break; case VG_USERREQ__POST_PTHREAD_COND_WAIT: - drd_post_cond_wait(arg[1]/*cond*/, arg[3]/*mutex*/, - arg[4]/*mutex_size*/); + drd_post_cond_wait(arg[1]/*cond*/, arg[2]/*mutex*/, + arg[3]/*mutex_size*/, arg[4]/*mutex_type*/); break; case VG_USERREQ__PRE_PTHREAD_COND_SIGNAL: diff --git a/exp-drd/drd_clientreq.h b/exp-drd/drd_clientreq.h index 052a96ddec..bb701e2983 100644 --- a/exp-drd/drd_clientreq.h +++ b/exp-drd/drd_clientreq.h @@ -76,11 +76,11 @@ enum { /* args: Addr */ /* to notify the drd tool of a pthread_cond_destroy call. */ VG_USERREQ__PRE_PTHREAD_COND_DESTROY, - /* args: Addr cond, SizeT cond_size, Addr mutex, SizeT mutex_size */ + /* args: Addr cond, SizeT cond_size, Addr mutex, SizeT mutex_size, MutexT mt */ VG_USERREQ__PRE_PTHREAD_COND_WAIT, - /* args: Addr cond, SizeT cond_size, Addr mutex, SizeT mutex_size */ + /* args: Addr cond, SizeT cond_size, Addr mutex, MutexT mt */ VG_USERREQ__POST_PTHREAD_COND_WAIT, - /* args: Addr cond, SizeT cond_size, Addr mutex, SizeT mutex_size */ + /* args: Addr cond, Addr mutex, SizeT mutex_size, MutexT mt */ VG_USERREQ__PRE_PTHREAD_COND_SIGNAL, /* args: Addr cond */ VG_USERREQ__PRE_PTHREAD_COND_BROADCAST, @@ -119,8 +119,10 @@ enum { typedef enum { - mutex_type_mutex = 1, - mutex_type_spinlock = 2, + mutex_type_recursive_mutex = 1, + mutex_type_errorcheck_mutex = 2, + mutex_type_default_mutex = 3, + mutex_type_spinlock = 4, } MutexT; diff --git a/exp-drd/drd_error.c b/exp-drd/drd_error.c index bc76f5a180..5e63e7c355 100644 --- a/exp-drd/drd_error.c +++ b/exp-drd/drd_error.c @@ -261,7 +261,7 @@ static void drd_tool_error_pp(Error* const e) MutexErrInfo* p = (MutexErrInfo*)(VG_(get_error_extra)(e)); tl_assert(p); VG_(message)(Vg_UserMsg, - "%s / mutex 0x%lx (recursion count %d, owner %d)", + "%s: address 0x%lx, recursion count %d, owner %d.", VG_(get_error_string)(e), p->mutex, p->recursion_count, diff --git a/exp-drd/drd_intercepts.c b/exp-drd/drd_intercepts.c index cb585cda4c..bc0f3c763e 100644 --- a/exp-drd/drd_intercepts.c +++ b/exp-drd/drd_intercepts.c @@ -85,6 +85,40 @@ static int vg_main_thread_state_is_set = 0; // Function definitions. +static MutexT pthread_to_drd_mutex_type(const int kind) +{ + switch (kind) + { + /* PTHREAD_MUTEX_RECURSIVE_NP */ + case PTHREAD_MUTEX_RECURSIVE: + return mutex_type_recursive_mutex; + /* PTHREAD_MUTEX_ERRORCHECK_NP */ + case PTHREAD_MUTEX_ERRORCHECK: + return mutex_type_errorcheck_mutex; + /* PTHREAD_MUTEX_TIMED_NP */ + /* PTHREAD_MUTEX_NORMAL */ + case PTHREAD_MUTEX_DEFAULT: + case PTHREAD_MUTEX_ADAPTIVE_NP: + return mutex_type_default_mutex; +#if 0 + case -1: + printf("Warning: changed mutex type from -1 into %d\n", + mutex_type_default_mutex); + return mutex_type_default_mutex; +#endif + } +#if 0 + printf("mutex->__data.__kind = %d\n", kind); + assert(0); +#endif + return mutex_type_default_mutex; +} + +static MutexT mutex_type(pthread_mutex_t* mutex) +{ + return pthread_to_drd_mutex_type(mutex->__data.__kind); +} + static void vg_start_suppression(const void* const p, size_t const size) { int res; @@ -267,9 +301,13 @@ PTH_FUNC(int, pthreadZumutexZuinit, int ret; int res; OrigFn fn; + int mt = PTHREAD_MUTEX_DEFAULT; VALGRIND_GET_ORIG_FN(fn); + if (attr) + pthread_mutexattr_gettype(attr, &mt); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_MUTEX_INIT, - mutex, sizeof(*mutex), mutex_type_mutex, 0, 0); + mutex, sizeof(*mutex), + pthread_to_drd_mutex_type(mt), 0, 0); CALL_FN_W_WW(ret, fn, mutex, attr); return ret; } @@ -284,7 +322,7 @@ PTH_FUNC(int, pthreadZumutexZudestroy, VALGRIND_GET_ORIG_FN(fn); CALL_FN_W_W(ret, fn, mutex); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_MUTEX_DESTROY, - mutex, mutex_type_mutex, 0, 0, 0); + mutex, mutex_type(mutex), 0, 0, 0); return ret; } @@ -297,7 +335,7 @@ PTH_FUNC(int, pthreadZumutexZulock, // pthread_mutex_lock OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__PRE_PTHREAD_MUTEX_LOCK, - mutex, sizeof(*mutex), mutex_type_mutex, 0, 0); + mutex, sizeof(*mutex), mutex_type(mutex), 0, 0); #if 1 // The only purpose of the system call below is to make drd work on AMD64 // systems. Without this system call, clients crash (SIGSEGV) in @@ -307,7 +345,7 @@ PTH_FUNC(int, pthreadZumutexZulock, // pthread_mutex_lock CALL_FN_W_W(ret, fn, mutex); if (ret == 0) VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__POST_PTHREAD_MUTEX_LOCK, - mutex, sizeof(*mutex), mutex_type_mutex, 0, 0); + mutex, sizeof(*mutex), mutex_type(mutex), 0, 0); return ret; } @@ -323,7 +361,7 @@ PTH_FUNC(int, pthreadZumutexZutrylock, // pthread_mutex_trylock if (ret == 0) { VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_MUTEX_LOCK, - mutex, sizeof(*mutex), mutex_type_mutex, 0, 0); + mutex, sizeof(*mutex), mutex_type(mutex), 0, 0); } return ret; } @@ -341,7 +379,7 @@ PTH_FUNC(int, pthreadZumutexZutimedlock, // pthread_mutex_timedlock if (ret == 0) { VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_MUTEX_LOCK, - mutex, sizeof(*mutex), mutex_type_mutex, 0, 0); + mutex, sizeof(*mutex), mutex_type(mutex), 0, 0); } return ret; } @@ -356,7 +394,7 @@ PTH_FUNC(int, pthreadZumutexZuunlock, // pthread_mutex_unlock VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_PTHREAD_MUTEX_UNLOCK, - mutex, sizeof(*mutex), mutex_type_mutex, 0, 0); + mutex, sizeof(*mutex), mutex_type(mutex), 0, 0); CALL_FN_W_W(ret, fn, mutex); return ret; } @@ -400,10 +438,10 @@ PTH_FUNC(int, pthreadZucondZuwaitZa, // pthread_cond_wait* OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_PTHREAD_COND_WAIT, - cond, sizeof(*cond), mutex, sizeof(*mutex), 0); + cond, sizeof(*cond), mutex, mutex_type(mutex), 0); CALL_FN_W_WW(ret, fn, cond, mutex); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_COND_WAIT, - cond, sizeof(*cond), mutex, sizeof(*mutex), 0); + cond, mutex, sizeof(*mutex), mutex_type(mutex), 0); return ret; } @@ -418,10 +456,10 @@ PTH_FUNC(int, pthreadZucondZutimedwaitZa, // pthread_cond_timedwait* OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_PTHREAD_COND_WAIT, - cond, sizeof(*cond), mutex, sizeof(*mutex), 0); + cond, sizeof(*cond), mutex, mutex_type(mutex), 0); CALL_FN_W_WWW(ret, fn, cond, mutex, abstime); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_COND_WAIT, - cond, sizeof(*cond), mutex, sizeof(*mutex), 0); + cond, mutex, sizeof(*mutex), mutex_type(mutex), 0); return ret; } diff --git a/exp-drd/drd_mutex.c b/exp-drd/drd_mutex.c index 4fcf34e984..d7a1072213 100644 --- a/exp-drd/drd_mutex.c +++ b/exp-drd/drd_mutex.c @@ -49,6 +49,7 @@ struct mutex_info // Local functions. +static Bool mutex_is_locked(struct mutex_info* const p); static void mutex_destroy(struct mutex_info* const p); @@ -75,8 +76,10 @@ void mutex_initialize(struct mutex_info* const p, { tl_assert(mutex != 0); tl_assert(size > 0); +#if 0 tl_assert(mutex_type == mutex_type_mutex || mutex_type == mutex_type_spinlock); +#endif p->mutex = mutex; p->size = size; @@ -94,13 +97,20 @@ mutex_get_or_allocate(const Addr mutex, { int i; +#if 0 tl_assert(mutex_type == mutex_type_mutex || mutex_type == mutex_type_spinlock); +#endif for (i = 0; i < sizeof(s_mutex)/sizeof(s_mutex[0]); i++) { if (s_mutex[i].mutex == mutex) { + if (s_mutex[i].mutex_type != mutex_type) + { + VG_(message)(Vg_DebugMsg, "??? mutex %p: type changed from %d into %d", + s_mutex[i].mutex, s_mutex[i].mutex_type, mutex_type); + } tl_assert(s_mutex[i].mutex_type == mutex_type); tl_assert(s_mutex[i].size == size); return &s_mutex[i]; @@ -146,8 +156,11 @@ mutex_init(const Addr mutex, const SizeT size, const MutexT mutex_type) mutex); } +#if 0 tl_assert(mutex_type == mutex_type_mutex || mutex_type == mutex_type_spinlock); +#endif + mutex_p = mutex_get(mutex); if (mutex_p) { @@ -179,6 +192,16 @@ static void mutex_destroy(struct mutex_info* const p) p->mutex); } + if (mutex_is_locked(p)) + { + MutexErrInfo MEI = { p->mutex, p->recursion_count, p->owner }; + VG_(maybe_record_error)(VG_(get_running_tid)(), + MutexErr, + VG_(get_IP)(VG_(get_running_tid)()), + "Destroying locked mutex", + &MEI); + } + drd_finish_suppression(p->mutex, p->mutex + p->size); vc_cleanup(&p->vc); @@ -255,8 +278,11 @@ int mutex_lock(const Addr mutex, const SizeT size, MutexT mutex_type) return 0; } +#if 0 tl_assert(mutex_type == mutex_type_mutex || mutex_type == mutex_type_spinlock); +#endif + tl_assert(p->mutex_type == mutex_type); tl_assert(p->size == size); @@ -321,7 +347,7 @@ int mutex_unlock(const Addr mutex, const MutexT mutex_type) p->owner); } - if (p == 0 || p->owner == DRD_INVALID_THREADID) + if (p == 0) { GenericErrInfo GEI; VG_(maybe_record_error)(vg_tid, @@ -332,11 +358,29 @@ int mutex_unlock(const Addr mutex, const MutexT mutex_type) return 0; } + if (p->owner == DRD_INVALID_THREADID) + { + MutexErrInfo MEI = { p->mutex, p->recursion_count, p->owner }; + VG_(maybe_record_error)(vg_tid, + MutexErr, + VG_(get_IP)(vg_tid), + "Mutex not locked", + &MEI); + return 0; + } + tl_assert(p); + if (p->mutex_type != mutex_type) + { + VG_(message)(Vg_DebugMsg, "??? mutex %p: type changed from %d into %d", + p->mutex, p->mutex_type, mutex_type); + } tl_assert(p->mutex_type == mutex_type); tl_assert(p->owner != DRD_INVALID_THREADID); +#if 0 tl_assert(mutex_type == mutex_type_mutex || mutex_type == mutex_type_spinlock); +#endif if (p->owner != drd_tid) { @@ -383,7 +427,11 @@ const char* mutex_type_name(const MutexT mt) { switch (mt) { - case mutex_type_mutex: + case mutex_type_recursive_mutex: + return "recursive mutex"; + case mutex_type_errorcheck_mutex: + return "error checking mutex"; + case mutex_type_default_mutex: return "mutex"; case mutex_type_spinlock: return "spinlock"; @@ -393,6 +441,13 @@ const char* mutex_type_name(const MutexT mt) return "?"; } +/** Return true if the specified mutex is locked by any thread. */ +static Bool mutex_is_locked(struct mutex_info* const p) +{ + tl_assert(p); + return (p->recursion_count > 0); +} + Bool mutex_is_locked_by(const Addr mutex, const DrdThreadId tid) { struct mutex_info* const p = mutex_get(mutex); @@ -419,8 +474,6 @@ int mutex_get_recursion_count(const Addr mutex) /** * Call this function when thread tid stops to exist, such that the * "last owner" field can be cleared if it still refers to that thread. - * TO DO: print an error message if a thread exits while it still has some - * mutexes locked. */ void mutex_thread_delete(const DrdThreadId tid) { @@ -428,8 +481,15 @@ void mutex_thread_delete(const DrdThreadId tid) for (i = 0; i < sizeof(s_mutex)/sizeof(s_mutex[0]); i++) { struct mutex_info* const p = &s_mutex[i]; - if (p->mutex && p->owner == tid) + if (p->mutex && p->owner == tid && p->recursion_count > 0) { + MutexErrInfo MEI + = { p->mutex, p->recursion_count, p->owner }; + VG_(maybe_record_error)(VG_(get_running_tid)(), + MutexErr, + VG_(get_IP)(VG_(get_running_tid)()), + "Mutex still locked at thread exit", + &MEI); p->owner = VG_INVALID_THREADID; } } diff --git a/exp-drd/tests/Makefile.am b/exp-drd/tests/Makefile.am index 3f2cfcdb19..a89349153f 100644 --- a/exp-drd/tests/Makefile.am +++ b/exp-drd/tests/Makefile.am @@ -50,6 +50,7 @@ EXTRA_DIST = $(noinst_SCRIPTS) \ pth_detached.stdout.exp pth_detached.stderr.exp \ pth_detached2.vgtest \ pth_detached2.stdout.exp pth_detached2.stderr.exp \ + recursive_mutex.vgtest recursive_mutex.stderr.exp \ sem_as_mutex.vgtest \ sem_as_mutex.stderr.exp sem_as_mutex.stderr.exp2 \ sem_as_mutex2.vgtest \ @@ -128,6 +129,7 @@ check_PROGRAMS = \ pth_create_chain \ pth_detached \ sem_as_mutex \ + recursive_mutex \ sigalrm \ tc01_simple_race \ tc02_simple_tls \ @@ -195,6 +197,9 @@ pth_create_chain_LDADD = -lpthread pth_detached_SOURCES = pth_detached.c pth_detached_LDADD = -lpthread +recursive_mutex_SOURCES = recursive_mutex.c +recursive_mutex_LDADD = -lpthread + sem_as_mutex_SOURCES = sem_as_mutex.c sem_as_mutex_LDADD = -lpthread @@ -219,11 +224,11 @@ tc05_simple_race_LDADD = -lpthread tc06_two_races_SOURCES = ../../helgrind/tests/tc06_two_races.c tc06_two_races_LDADD = -lpthread -tc07_hbl1_SOURCES = ../../helgrind/tests/tc07_hbl1.c -tc07_hbl1_LDADD = -lpthread +# tc07_hbl1_SOURCES = ../../helgrind/tests/tc07_hbl1.c +# tc07_hbl1_LDADD = -lpthread -tc08_hbl2_SOURCES = ../../helgrind/tests/tc08_hbl2.c -tc08_hbl2_LDADD = -lpthread +# tc08_hbl2_SOURCES = ../../helgrind/tests/tc08_hbl2.c +# tc08_hbl2_LDADD = -lpthread tc09_bad_unlock_SOURCES = ../../helgrind/tests/tc09_bad_unlock.c tc09_bad_unlock_LDADD = -lpthread diff --git a/exp-drd/tests/recursive_mutex.c b/exp-drd/tests/recursive_mutex.c new file mode 100644 index 0000000000..62d90e3cf8 --- /dev/null +++ b/exp-drd/tests/recursive_mutex.c @@ -0,0 +1,57 @@ +/** Initialize a recursive mutex and lock it twice. + * No error messages may be printed. + */ + +#define _GNU_SOURCE + +#include +#include + +static void lock_twice(pthread_mutex_t* const p) +{ + pthread_mutex_lock(p); + pthread_mutex_lock(p); + pthread_mutex_unlock(p); + pthread_mutex_unlock(p); +} + +int main(int argc, char** argv) +{ + { + pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; + + printf("Recursive mutex (statically initialized).\n"); + lock_twice(&m); + } + { + pthread_mutex_t m; + pthread_mutexattr_t attr; + + printf("Recursive mutex (initialized via mutex attributes).\n"); + pthread_mutexattr_init(&attr); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); + pthread_mutex_init(&m, &attr); + pthread_mutexattr_destroy(&attr); + lock_twice(&m); + pthread_mutex_destroy(&m); + } + { + pthread_mutex_t m; + pthread_mutexattr_t attr; + + printf("Error checking mutex.\n"); + pthread_mutexattr_init(&attr); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK_NP); + pthread_mutex_init(&m, &attr); + pthread_mutexattr_destroy(&attr); + lock_twice(&m); + pthread_mutex_destroy(&m); + } + { + pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER; + + printf("Non-recursive mutex.\n"); + lock_twice(&m); + } + return 0; +} diff --git a/exp-drd/tests/tc04_free_lock.stderr.exp b/exp-drd/tests/tc04_free_lock.stderr.exp index d18786f806..953a3f226e 100644 --- a/exp-drd/tests/tc04_free_lock.stderr.exp +++ b/exp-drd/tests/tc04_free_lock.stderr.exp @@ -1,3 +1,18 @@ +Destroying locked mutex: address 0x........, recursion count 1, owner 1. + at 0x........: free (vg_replace_malloc.c:...) + by 0x........: main (tc04_free_lock.c:24) -ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) +Destroying locked mutex: address 0x........, recursion count 1, owner 1. + at 0x........: bar (tc04_free_lock.c:40) + by 0x........: main (tc04_free_lock.c:26) + +Destroying locked mutex: address 0x........, recursion count 1, owner 1. + at 0x........: foo (tc04_free_lock.c:49) + by 0x........: main (tc04_free_lock.c:27) + +Destroying locked mutex: address 0x........, recursion count 1, owner 1. + at 0x........: bar (tc04_free_lock.c:40) + by 0x........: main (tc04_free_lock.c:28) + +ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0) diff --git a/exp-drd/tests/tc09_bad_unlock.stderr.exp b/exp-drd/tests/tc09_bad_unlock.stderr.exp index a631ae6396..a16e24c7cb 100644 --- a/exp-drd/tests/tc09_bad_unlock.stderr.exp +++ b/exp-drd/tests/tc09_bad_unlock.stderr.exp @@ -1,11 +1,11 @@ -Attempt to unlock a mutex that is not locked / mutex 0x........ (recursion count -1, owner 1) +Attempt to unlock a mutex that is not locked: address 0x........, recursion count -1, owner 1. at 0x........: pthread_mutex_unlock (drd_intercepts.c:?) by 0x........: nearly_main (tc09_bad_unlock.c:27) by 0x........: main (tc09_bad_unlock.c:49) Thread 2: -Mutex not unlocked by owner thread / mutex 0x........ (recursion count 1, owner 1) +Mutex not unlocked by owner thread: address 0x........, recursion count 1, owner 1. at 0x........: pthread_mutex_unlock (drd_intercepts.c:?) by 0x........: child_fn (tc09_bad_unlock.c:11) by 0x........: vg_thread_wrapper (drd_intercepts.c:?) @@ -18,13 +18,13 @@ Not a mutex by 0x........: nearly_main (tc09_bad_unlock.c:41) by 0x........: main (tc09_bad_unlock.c:49) -Attempt to unlock a mutex that is not locked / mutex 0x........ (recursion count -1, owner 1) +Attempt to unlock a mutex that is not locked: address 0x........, recursion count -1, owner 1. at 0x........: pthread_mutex_unlock (drd_intercepts.c:?) by 0x........: nearly_main (tc09_bad_unlock.c:27) by 0x........: main (tc09_bad_unlock.c:50) Thread 2: -Mutex not unlocked by owner thread / mutex 0x........ (recursion count 1, owner 1) +Mutex not unlocked by owner thread: address 0x........, recursion count 1, owner 1. at 0x........: pthread_mutex_unlock (drd_intercepts.c:?) by 0x........: child_fn (tc09_bad_unlock.c:11) by 0x........: vg_thread_wrapper (drd_intercepts.c:?) diff --git a/exp-drd/tests/tc10_rec_lock.stderr.exp b/exp-drd/tests/tc10_rec_lock.stderr.exp index d7ba11983f..705c9e6c60 100644 --- a/exp-drd/tests/tc10_rec_lock.stderr.exp +++ b/exp-drd/tests/tc10_rec_lock.stderr.exp @@ -6,7 +6,7 @@ before unlock #1 before unlock #2 before unlock #3 before unlock #4 -Attempt to unlock a mutex that is not locked / mutex 0x........ (recursion count -1, owner 1) +Attempt to unlock a mutex that is not locked: address 0x........, recursion count -1, owner 1. at 0x........: pthread_mutex_unlock (drd_intercepts.c:?) by 0x........: nearly_main (tc10_rec_lock.c:42) by 0x........: main (tc10_rec_lock.c:47) diff --git a/exp-drd/tests/tc20_verifywrap.stderr.exp b/exp-drd/tests/tc20_verifywrap.stderr.exp index 10c23dbdfb..a5d0979287 100644 --- a/exp-drd/tests/tc20_verifywrap.stderr.exp +++ b/exp-drd/tests/tc20_verifywrap.stderr.exp @@ -16,18 +16,22 @@ Other segment end (thread 2) ---------------- pthread_mutex_lock et al ---------------- -Destroying locked mutex / mutex 0x........ (recursion count 1, owner 1) +Destroying locked mutex: address 0x........, recursion count 1, owner 1. at 0x........: pthread_mutex_destroy (drd_intercepts.c:?) by 0x........: main (tc20_verifywrap.c:102) -Not a mutex +Destroying locked mutex: address 0x........, recursion count 1, owner 1. + at 0x........: pthread_mutex_destroy (drd_intercepts.c:?) + by 0x........: main (tc20_verifywrap.c:102) + +Mutex not locked: address 0x........, recursion count 0, owner 0. at 0x........: pthread_mutex_unlock (drd_intercepts.c:?) by 0x........: main (tc20_verifywrap.c:125) ---------------- pthread_cond_wait et al ---------------- -Not a mutex +Mutex not locked: address 0x........, recursion count 0, owner 0. at 0x........: pthread_cond_wait* (drd_intercepts.c:?) by 0x........: main (tc20_verifywrap.c:147) @@ -60,4 +64,7 @@ FIXME: can't figure out how to verify wrap of sem_post ------------ dealloc of mem holding locks ------------ -ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0) +Destroying locked mutex: address 0x........, recursion count 1, owner 1. + at 0x........: main (tc20_verifywrap.c:261) + +ERROR SUMMARY: 6 errors from 6 contexts (suppressed: 0 from 0) diff --git a/exp-drd/tests/tc22_exit_w_lock.stderr.exp-32bit b/exp-drd/tests/tc22_exit_w_lock.stderr.exp-32bit index c443f2f7d4..aa416a4aad 100644 --- a/exp-drd/tests/tc22_exit_w_lock.stderr.exp-32bit +++ b/exp-drd/tests/tc22_exit_w_lock.stderr.exp-32bit @@ -131,4 +131,8 @@ Other segment start (thread 2) Other segment end (thread 2) (thread finished, call stack no longer available) -ERROR SUMMARY: 11 errors from 11 contexts (suppressed: 0 from 0) +Mutex still locked at thread exit: address 0x........, recursion count 1, owner 3. + at 0x........: pthread_join (drd_intercepts.c:?) + by 0x........: main (tc22_exit_w_lock.c:43) + +ERROR SUMMARY: 12 errors from 12 contexts (suppressed: 0 from 0) diff --git a/exp-drd/tests/tc22_exit_w_lock.stderr.exp b/exp-drd/tests/tc22_exit_w_lock.stderr.exp-64bit similarity index 100% rename from exp-drd/tests/tc22_exit_w_lock.stderr.exp rename to exp-drd/tests/tc22_exit_w_lock.stderr.exp-64bit diff --git a/exp-drd/tests/tc23_bogus_condwait.stderr.exp b/exp-drd/tests/tc23_bogus_condwait.stderr.exp index ede5af6298..66f500da5b 100644 --- a/exp-drd/tests/tc23_bogus_condwait.stderr.exp +++ b/exp-drd/tests/tc23_bogus_condwait.stderr.exp @@ -20,7 +20,7 @@ Not a mutex at 0x........: pthread_cond_wait* (drd_intercepts.c:?) by 0x........: main (tc23_bogus_condwait.c:69) -Not a mutex +Mutex not locked: address 0x........, recursion count 0, owner 0. at 0x........: pthread_cond_wait* (drd_intercepts.c:?) by 0x........: main (tc23_bogus_condwait.c:72) @@ -46,7 +46,7 @@ Race condition: condition variable 0x........ has been signalled but the associa by 0x........: clone (in /...libc...) Thread 1: -Mutex not unlocked by owner thread / mutex 0x........ (recursion count 1, owner 2) +Mutex not unlocked by owner thread: address 0x........, recursion count 1, owner 2. at 0x........: pthread_cond_wait* (drd_intercepts.c:?) by 0x........: main (tc23_bogus_condwait.c:78) @@ -59,7 +59,7 @@ Race condition: condition variable 0x........ has been signalled but the associa by 0x........: clone (in /...libc...) Thread 2: -Mutex not unlocked by owner thread / mutex 0x........ (recursion count 1, owner 1) +Mutex not unlocked by owner thread: address 0x........, recursion count 1, owner 1. at 0x........: pthread_mutex_unlock (drd_intercepts.c:?) by 0x........: grab_the_lock (tc23_bogus_condwait.c:42) by 0x........: vg_thread_wrapper (drd_intercepts.c:?)