cond_pre_wait(cond, cond_size, mutex);
}
-static void drd_post_cond_wait(const Addr cond, const Addr mutex,
- const SizeT size, const MutexT mutex_type,
+static void drd_post_cond_wait(const Addr cond,
+ const Addr mutex,
const Bool took_lock)
{
cond_post_wait(cond);
- mutex_post_lock(mutex, size, mutex_type, took_lock);
+ mutex_post_lock(mutex, took_lock);
}
static void drd_pre_cond_signal(const Addr cond)
break;
case VG_USERREQ__PRE_PTHREAD_MUTEX_LOCK:
- drd_pre_mutex_lock(thread_get_running_tid(), arg[1], arg[2], arg[3]);
+ drd_pre_mutex_lock(arg[1], arg[2], arg[3]);
break;
case VG_USERREQ__POST_PTHREAD_MUTEX_LOCK:
- drd_post_mutex_lock(thread_get_running_tid(),
- arg[1], arg[2], arg[3], arg[4]);
+ drd_post_mutex_lock(arg[1], arg[2]);
break;
case VG_USERREQ__PRE_PTHREAD_MUTEX_UNLOCK:
- drd_pre_mutex_unlock(thread_get_running_tid(), arg[1], arg[3]);
+ drd_pre_mutex_unlock(arg[1], arg[3]);
break;
case VG_USERREQ__SPIN_INIT_OR_UNLOCK:
break;
case VG_USERREQ__POST_PTHREAD_COND_WAIT:
- drd_post_cond_wait(arg[1]/*cond*/, arg[2]/*mutex*/,
- arg[3]/*mutex_size*/, arg[4]/*mutex_type*/,
- arg[5]/*took_lock*/);
+ drd_post_cond_wait(arg[1]/*cond*/, arg[2]/*mutex*/, arg[3]/*took_lock*/);
break;
case VG_USERREQ__PRE_PTHREAD_COND_SIGNAL:
drd_barrier_post_wait(thread_get_running_tid(), arg[1], arg[2]);
break;
+ case VG_USERREQ__PRE_RWLOCK_INIT:
+ break;
+
+ case VG_USERREQ__POST_RWLOCK_DESTROY:
+ break;
+
+ case VG_USERREQ__PRE_RWLOCK_RDLOCK:
+ break;
+
+ case VG_USERREQ__POST_RWLOCK_RDLOCK:
+ break;
+
+ case VG_USERREQ__PRE_RWLOCK_WRLOCK:
+ break;
+
+ case VG_USERREQ__POST_RWLOCK_WRLOCK:
+ break;
+
+ case VG_USERREQ__POST_RWLOCK_UNLOCK:
+ break;
+
default:
VG_(message)(Vg_DebugMsg, "Unrecognized client request 0x%lx 0x%lx",
arg[0], arg[1]);
/* args: Addr, SizeT, MutexT */
/* to notify the drd tool of pthread_mutex_lock calls */
VG_USERREQ__POST_PTHREAD_MUTEX_LOCK,
- /* args: Addr, SizeT, MutexT, Bool */
+ /* args: Addr, Bool */
/* to notify the drd tool of pthread_mutex_unlock calls */
VG_USERREQ__PRE_PTHREAD_MUTEX_UNLOCK,
/* args: Addr */
VG_USERREQ__PRE_PTHREAD_COND_WAIT,
/* args: Addr cond, SizeT cond_size, Addr mutex, MutexT mt */
VG_USERREQ__POST_PTHREAD_COND_WAIT,
- /* args: Addr cond, Addr mutex, SizeT mutex_size, MutexT mt, Bool took_lock*/
+ /* args: Addr cond, Addr mutex, Bool took_lock*/
VG_USERREQ__PRE_PTHREAD_COND_SIGNAL,
/* args: Addr cond */
VG_USERREQ__PRE_PTHREAD_COND_BROADCAST,
VG_USERREQ__POST_BARRIER_WAIT,
/* args: Addr barrier, Word has_waited */
+ /* To notify the drd tool of a pthread_rwlock_init call. */
+ VG_USERREQ__PRE_RWLOCK_INIT,
+ /* args: Addr rwlock, SizeT size */
+ /* To notify the drd tool of a pthread_rwlock_destroy call. */
+ VG_USERREQ__POST_RWLOCK_DESTROY,
+ /* args: Addr rwlock, SizeT size */
+ /* To notify the drd tool of a pthread_rwlock_rdlock call. */
+ VG_USERREQ__PRE_RWLOCK_RDLOCK,
+ /* args: Addr rwlock, SizeT size */
+ /* To notify the drd tool of a pthread_rwlock_rdlock call. */
+ VG_USERREQ__POST_RWLOCK_RDLOCK,
+ /* args: Addr rwlock, Bool took_lock */
+ /* To notify the drd tool of a pthread_rwlock_wrlock call. */
+ VG_USERREQ__PRE_RWLOCK_WRLOCK,
+ /* args: Addr rwlock, SizeT size */
+ /* To notify the drd tool of a pthread_rwlock_wrlock call. */
+ VG_USERREQ__POST_RWLOCK_WRLOCK,
+ /* args: Addr rwlock, Bool took_lock */
+ /* To notify the drd tool of a pthread_rwlock_unlock call. */
+ VG_USERREQ__POST_RWLOCK_UNLOCK,
+ /* args: Addr rwlock, Bool unlocked */
+
};
typedef enum
}
p = cond_get(cond);
+ // To do: print a proper error message if the assert below fails.
tl_assert(p);
+ // To do: print a proper error message if the assert below fails.
tl_assert(p->waiter_count > 0);
tl_assert(p->mutex);
if (--p->waiter_count == 0)
#endif
CALL_FN_W_W(ret, fn, mutex);
VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__POST_PTHREAD_MUTEX_LOCK,
- mutex, sizeof(*mutex), mutex_type(mutex),
- ret == 0, 0);
+ mutex, ret == 0, 0, 0, 0);
return ret;
}
int res;
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);
CALL_FN_W_W(ret, fn, mutex);
VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_MUTEX_LOCK,
- mutex, sizeof(*mutex), mutex_type(mutex),
- ret == 0, 0);
+ mutex, ret == 0, 0, 0, 0);
return ret;
}
int res;
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);
CALL_FN_W_WW(ret, fn, mutex, abs_timeout);
VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_MUTEX_LOCK,
- mutex, sizeof(*mutex), mutex_type(mutex),
- ret == 0, 0);
+ mutex, ret == 0, 0, 0, 0);
return ret;
}
0);
CALL_FN_W_WW(ret, fn, cond, mutex);
VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_COND_WAIT,
- cond, mutex, sizeof(*mutex), mutex_type(mutex),
- ret == 0);
+ cond, mutex, ret == 0, 0, 0);
return ret;
}
0);
CALL_FN_W_WWW(ret, fn, cond, mutex, abstime);
VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_COND_WAIT,
- cond, mutex, sizeof(*mutex), mutex_type(mutex),
- ret == 0);
+ cond, mutex, ret == 0, 0, 0);
return ret;
}
int res;
OrigFn fn;
VALGRIND_GET_ORIG_FN(fn);
+ VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__PRE_PTHREAD_MUTEX_LOCK,
+ spinlock, sizeof(*spinlock), mutex_type_spinlock,
+ 0, 0);
CALL_FN_W_W(ret, fn, spinlock);
VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_MUTEX_LOCK,
- spinlock, sizeof(*spinlock),
- mutex_type_spinlock, ret == 0, 0);
+ spinlock, ret == 0, 0, 0, 0);
return ret;
}
int res;
OrigFn fn;
VALGRIND_GET_ORIG_FN(fn);
+ VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__PRE_PTHREAD_MUTEX_LOCK,
+ spinlock, sizeof(*spinlock), mutex_type_spinlock,
+ 0, 0);
CALL_FN_W_W(ret, fn, spinlock);
VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_PTHREAD_MUTEX_LOCK,
- spinlock, sizeof(*spinlock),
- mutex_type_spinlock, ret == 0, 0);
+ spinlock, ret == 0, 0, 0, 0);
return ret;
}
typedef struct { long int sem_status; } sem_t_glibc_2_0;
// sem_init
-PTH_FUNC(int, sem_initZAGLIBCZu2Zd0, // sem_init@GLIBC_2.0
+PTH_FUNC(int, semZuinitZAGLIBCZu2Zd0, // sem_init@GLIBC_2.0
sem_t_glibc_2_0 *sem,
int pshared,
unsigned int value)
return ret;
}
-PTH_FUNC(int, sem_initZa, // sem_init*
+PTH_FUNC(int, semZuinitZa, // sem_init*
sem_t *sem,
int pshared,
unsigned int value)
}
// sem_destroy
-PTH_FUNC(int, sem_destroyZAGLIBCZu2Zd0, // sem_destroy@GLIBC_2.0
+PTH_FUNC(int, semZudestroyZAGLIBCZu2Zd0, // sem_destroy@GLIBC_2.0
sem_t_glibc_2_0 *sem)
{
int ret;
return ret;
}
-PTH_FUNC(int, sem_destroyZa, // sem_destroy*
+PTH_FUNC(int, semZudestroyZa, // sem_destroy*
sem_t *sem)
{
int ret;
}
// sem_wait
-PTH_FUNC(int, sem_waitZAGLIBCZu2Zd0, // sem_wait@GLIBC_2.0
+PTH_FUNC(int, semZuwaitZAGLIBCZu2Zd0, // sem_wait@GLIBC_2.0
sem_t_glibc_2_0 *sem)
{
int ret;
}
// sem_wait
-PTH_FUNC(int, sem_waitZa, // sem_wait*
+PTH_FUNC(int, semZuwaitZa, // sem_wait*
sem_t *sem)
{
int ret;
}
// sem_trywait
-PTH_FUNC(int, sem_trywaitZAGLIBCZu2Zd0, // sem_trywait@GLIBC_2.0
+PTH_FUNC(int, semZutrywaitZAGLIBCZu2Zd0, // sem_trywait@GLIBC_2.0
sem_t_glibc_2_0 *sem)
{
int ret;
return ret;
}
-PTH_FUNC(int, sem_trywaitZa, // sem_trywait*
+PTH_FUNC(int, semZutrywaitZa, // sem_trywait*
sem_t *sem)
{
int ret;
}
// sem_timedwait
-PTH_FUNC(int, sem_timedwait, // sem_timedwait
+PTH_FUNC(int, semZutimedwait, // sem_timedwait
sem_t *sem, const struct timespec *abs_timeout)
{
int ret;
}
// sem_post
-PTH_FUNC(int, sem_postZAGLIBCZu2Zd0, // sem_post@GLIBC_2.0
+PTH_FUNC(int, semZupostZAGLIBCZu2Zd0, // sem_post@GLIBC_2.0
sem_t_glibc_2_0 *sem)
{
int ret;
return ret;
}
-PTH_FUNC(int, sem_postZa, // sem_post*
+// sem_post
+PTH_FUNC(int, semZupostZa, // sem_post*
sem_t *sem)
{
int ret;
return ret;
}
-/*
-pthread_rwlock_destroy
-pthread_rwlock_init
-pthread_rwlock_rdlock
-pthread_rwlock_timedrdlock
-pthread_rwlock_timedwrlock
-pthread_rwlock_tryrdlock
-pthread_rwlock_trywrlock
-pthread_rwlock_unlock
-pthread_rwlock_wrlock
-pthread_rwlockattr_destroy
-pthread_rwlockattr_getkind_np
-pthread_rwlockattr_getpshared
-pthread_rwlockattr_init
-pthread_rwlockattr_setkind_np
-pthread_rwlockattr_setpshared
- */
+// pthread_rwlock_init
+PTH_FUNC(int,
+ pthreadZurwlockZuinitZa, // pthread_rwlock_init*
+ pthread_rwlock_t* rwlock,
+ const pthread_rwlockattr_t* attr)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_RWLOCK_INIT,
+ rwlock, sizeof(*rwlock), 0, 0, 0);
+ CALL_FN_W_WW(ret, fn, rwlock, attr);
+ return ret;
+}
+
+// pthread_rwlock_destroy
+PTH_FUNC(int,
+ pthreadZurwlockZudestroyZa, // pthread_rwlock_destroy*
+ pthread_rwlock_t* rwlock)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ CALL_FN_W_W(ret, fn, rwlock);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_RWLOCK_DESTROY,
+ rwlock, 0, 0, 0, 0);
+ return ret;
+}
+
+// pthread_rwlock_rdlock
+PTH_FUNC(int,
+ pthreadZurwlockZurdlockZa, // pthread_rwlock_rdlock*
+ pthread_rwlock_t* rwlock)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_RWLOCK_RDLOCK,
+ rwlock, sizeof(*rwlock), 0, 0, 0);
+ CALL_FN_W_W(ret, fn, rwlock);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_RWLOCK_RDLOCK,
+ rwlock, ret == 0, 0, 0, 0);
+ return ret;
+}
+
+// pthread_rwlock_wrlock
+PTH_FUNC(int,
+ pthreadZurwlockZuwrlockZa, // pthread_rwlock_wrlock*
+ pthread_rwlock_t* rwlock)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_RWLOCK_WRLOCK,
+ rwlock, sizeof(*rwlock), 0, 0, 0);
+ CALL_FN_W_W(ret, fn, rwlock);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_RWLOCK_WRLOCK,
+ rwlock, ret == 0, 0, 0, 0);
+ return ret;
+}
+
+// pthread_rwlock_timedrdlock
+PTH_FUNC(int,
+ pthreadZurwlockZutimedrdlockZa, // pthread_rwlock_timedrdlock*
+ pthread_rwlock_t* rwlock)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_RWLOCK_RDLOCK,
+ rwlock, sizeof(*rwlock), 0, 0, 0);
+ CALL_FN_W_W(ret, fn, rwlock);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_RWLOCK_RDLOCK,
+ rwlock, ret == 0, 0, 0, 0);
+ return ret;
+}
+
+// pthread_rwlock_timedwrlock
+PTH_FUNC(int,
+ pthreadZurwlockZutimedwrlockZa, // pthread_rwlock_timedwrlock*
+ pthread_rwlock_t* rwlock)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_RWLOCK_WRLOCK,
+ rwlock, sizeof(*rwlock), 0, 0, 0);
+ CALL_FN_W_W(ret, fn, rwlock);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_RWLOCK_WRLOCK,
+ rwlock, ret == 0, 0, 0, 0);
+ return ret;
+}
+
+// pthread_rwlock_tryrdlock
+PTH_FUNC(int,
+ pthreadZurwlockZutryrdlockZa, // pthread_rwlock_tryrdlock*
+ pthread_rwlock_t* rwlock)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_RWLOCK_RDLOCK,
+ rwlock, sizeof(*rwlock), 0, 0, 0);
+ CALL_FN_W_W(ret, fn, rwlock);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_RWLOCK_RDLOCK,
+ rwlock, ret == 0, 0, 0, 0);
+ return ret;
+}
+
+// pthread_rwlock_trywrlock
+PTH_FUNC(int,
+ pthreadZurwlockZutrywrlockZa, // pthread_rwlock_trywrlock*
+ pthread_rwlock_t* rwlock)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_RWLOCK_WRLOCK,
+ rwlock, sizeof(*rwlock), 0, 0, 0);
+ CALL_FN_W_W(ret, fn, rwlock);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_RWLOCK_WRLOCK,
+ rwlock, ret == 0, 0, 0, 0);
+ return ret;
+}
+
+// pthread_rwlock_unlock
+PTH_FUNC(int,
+ pthreadZurwlockZuunlockZa, // pthread_rwlock_unlock*
+ pthread_rwlock_t* rwlock)
+{
+ int ret;
+ int res;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ CALL_FN_W_W(ret, fn, rwlock);
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_RWLOCK_UNLOCK,
+ rwlock, ret == 0, 0, 0, 0);
+ return ret;
+}
+
/*
* Local variables:
mutex_post_destroy(mutex);
}
-void drd_pre_mutex_lock(const DrdThreadId drd_tid,
- const Addr mutex,
+void drd_pre_mutex_lock(const Addr mutex,
const SizeT size,
const MutexT mutex_type)
{
mutex_pre_lock(mutex, size, mutex_type);
}
-void drd_post_mutex_lock(const DrdThreadId drd_tid,
- const Addr mutex,
- const SizeT size,
- const MutexT mutex_type,
- const Bool took_lock)
+void drd_post_mutex_lock(const Addr mutex, const Bool took_lock)
{
- mutex_post_lock(mutex, size, mutex_type, took_lock);
+ mutex_post_lock(mutex, took_lock);
}
-void drd_pre_mutex_unlock(const DrdThreadId drd_tid,
- const Addr mutex,
- const MutexT mutex_type)
+void drd_pre_mutex_unlock(const Addr mutex, const MutexT mutex_type)
{
mutex_unlock(mutex, mutex_type);
}
return &clientobj_get(mutex, ClientMutex)->mutex;
}
+/** Called before pthread_mutex_init(). */
struct mutex_info*
mutex_init(const Addr mutex, const SizeT size, const MutexT mutex_type)
{
- struct mutex_info* mutex_p;
+ struct mutex_info* p;
if (s_trace_mutex)
{
mutex);
}
- mutex_p = mutex_get(mutex);
- if (mutex_p)
+ if (mutex_type == mutex_type_invalid_mutex)
+ {
+ GenericErrInfo GEI;
+ VG_(maybe_record_error)(VG_(get_running_tid)(),
+ GenericErr,
+ VG_(get_IP)(VG_(get_running_tid)()),
+ "Invalid mutex",
+ &GEI);
+ return 0;
+ }
+
+ p = mutex_get(mutex);
+ if (p)
{
const ThreadId vg_tid = VG_(get_running_tid)();
MutexErrInfo MEI
- = { mutex_p->a1, mutex_p->recursion_count, mutex_p->owner };
+ = { p->a1, p->recursion_count, p->owner };
VG_(maybe_record_error)(vg_tid,
MutexErr,
VG_(get_IP)(vg_tid),
"Mutex reinitialization",
&MEI);
- return mutex_p;
+ return p;
}
- mutex_p = mutex_get_or_allocate(mutex, size, mutex_type);
+ p = mutex_get_or_allocate(mutex, size, mutex_type);
- return mutex_p;
+ return p;
}
/** Called after pthread_mutex_destroy(). */
struct mutex_info* p;
p = mutex_get(mutex);
+
+ if (s_trace_mutex)
+ {
+ VG_(message)(Vg_UserMsg,
+ "[%d/%d] pre_mutex_lock %s 0x%lx rc %d owner %d",
+ VG_(get_running_tid)(),
+ thread_get_running_tid(),
+ p ? mutex_get_typename(p) : "(?)",
+ mutex,
+ p ? p->recursion_count : 0,
+ p ? p->owner : VG_INVALID_THREADID);
+ }
+
+ if (mutex_type == mutex_type_invalid_mutex)
+ {
+ GenericErrInfo GEI;
+ VG_(maybe_record_error)(VG_(get_running_tid)(),
+ GenericErr,
+ VG_(get_IP)(VG_(get_running_tid)()),
+ "Invalid mutex",
+ &GEI);
+ return;
+ }
+
if (p == 0)
{
- mutex_init(mutex, size, mutex_type);
- p = mutex_get(mutex);
+ p = mutex_init(mutex, size, mutex_type);
}
tl_assert(p);
* Note: this function must be called after pthread_mutex_lock() has been
* called, or a race condition is triggered !
*/
-int mutex_post_lock(const Addr mutex, const SizeT size, MutexT mutex_type,
- const Bool took_lock)
+int mutex_post_lock(const Addr mutex, const Bool took_lock)
{
const DrdThreadId drd_tid = thread_get_running_tid();
- struct mutex_info* const p = mutex_get_or_allocate(mutex, size, mutex_type);
+ struct mutex_info* p;
+
+ p = mutex_get(mutex);
if (s_trace_mutex)
{
"[%d/%d] post_mutex_lock %s 0x%lx rc %d owner %d",
VG_(get_running_tid)(),
drd_tid,
- mutex_get_typename(p),
+ p ? mutex_get_typename(p) : "(?)",
mutex,
p ? p->recursion_count : 0,
p ? p->owner : VG_INVALID_THREADID);
}
- if (mutex_type == mutex_type_invalid_mutex)
- {
- GenericErrInfo GEI;
- VG_(maybe_record_error)(VG_(get_running_tid)(),
- GenericErr,
- VG_(get_IP)(VG_(get_running_tid)()),
- "Invalid mutex",
- &GEI);
- }
-
if (p == 0)
{
- GenericErrInfo GEI;
- VG_(maybe_record_error)(VG_(get_running_tid)(),
- GenericErr,
- VG_(get_IP)(VG_(get_running_tid)()),
- "Not a mutex",
- &GEI);
return 0;
}
if (! took_lock)
return p->recursion_count;
- tl_assert(p->mutex_type == mutex_type);
- tl_assert(p->a2 - p->a1 == size);
-
if (p->recursion_count == 0)
{
p->owner = drd_tid;
VG_(get_IP)(VG_(get_running_tid)()),
"Invalid mutex",
&GEI);
+ return 0;
}
if (p == 0)
struct mutex_info* mutex_get(const Addr mutex);
void mutex_pre_lock(const Addr mutex, const SizeT size,
const MutexT mutex_type);
-int mutex_post_lock(const Addr mutex, const SizeT size,
- const MutexT mutex_type, const Bool took_lock);
+int mutex_post_lock(const Addr mutex, const Bool took_lock);
int 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);
void drd_pre_mutex_init(Addr mutex, SizeT size, const MutexT mutex_type);
void drd_post_mutex_destroy(Addr mutex, const MutexT mutex_type);
-void drd_pre_mutex_lock(DrdThreadId tid, Addr mutex, const SizeT size,
+void drd_pre_mutex_lock(const Addr mutex, const SizeT size,
const MutexT mutex_type);
-void drd_post_mutex_lock(DrdThreadId tid, Addr mutex, const SizeT size,
- const MutexT mutex_type, const Bool took_lock);
-void drd_pre_mutex_unlock(const DrdThreadId tid, const Addr mutex,
- const MutexT mutex_type);
+void drd_post_mutex_lock(Addr mutex, const Bool took_lock);
+void drd_pre_mutex_unlock(const Addr mutex, const MutexT mutex_type);
void drd_pre_cond_init(Addr cond, SizeT s);
void drd_post_cond_destroy(Addr cond);
by 0x........: nearly_main (tc09_bad_unlock.c:41)
by 0x........: main (tc09_bad_unlock.c:49)
-Not a mutex
- at 0x........: pthread_mutex_unlock (drd_intercepts.c:?)
- 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: 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........: nearly_main (tc09_bad_unlock.c:41)
by 0x........: main (tc09_bad_unlock.c:50)
-Not a mutex
- at 0x........: pthread_mutex_unlock (drd_intercepts.c:?)
- by 0x........: nearly_main (tc09_bad_unlock.c:41)
- by 0x........: main (tc09_bad_unlock.c:50)
-
-ERROR SUMMARY: 8 errors from 8 contexts (suppressed: 0 from 0)
+ERROR SUMMARY: 6 errors from 6 contexts (suppressed: 0 from 0)
---------------- pthread_mutex_lock et al ----------------
+Invalid mutex
+ at 0x........: pthread_mutex_init (drd_intercepts.c:?)
+ by 0x........: main (tc20_verifywrap.c:92)
+
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)
at 0x........: pthread_mutex_unlock (drd_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:125)
-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 ----------------
---------------- pthread_mutex_lock et al ----------------
[1/1] mutex_init invalid mutex 0x........
+
+Invalid mutex
+ at 0x........: pthread_mutex_init (drd_intercepts.c:?)
+ by 0x........: main (tc20_verifywrap.c:92)
[1/1] mutex_init mutex 0x........
+[1/1] pre_mutex_lock mutex 0x........ rc 0 owner 0
[1/1] post_mutex_lock mutex 0x........ rc 0 owner 0
[1/1] mutex_destroy mutex 0x........
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)
-[1/1] mutex_init invalid mutex 0x........
-[1/1] post_mutex_lock invalid mutex 0x........ rc 0 owner 0
+[1/1] pre_mutex_lock (?) 0x........ rc 0 owner 0
Invalid mutex
at 0x........: pthread_mutex_lock (drd_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:108)
-[1/1] post_mutex_lock invalid mutex 0x........ rc 0 owner 0
+[1/1] post_mutex_lock (?) 0x........ rc 0 owner 0
+[1/1] pre_mutex_lock (?) 0x........ rc 0 owner 0
Invalid mutex
at 0x........: pthread_mutex_trylock (drd_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:116)
-[1/1] post_mutex_lock invalid mutex 0x........ rc 0 owner 0
+[1/1] post_mutex_lock (?) 0x........ rc 0 owner 0
+[1/1] pre_mutex_lock (?) 0x........ rc 0 owner 0
Invalid mutex
at 0x........: pthread_mutex_timedlock (drd_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:121)
-[1/1] mutex_unlock invalid mutex 0x........ rc 0
+[1/1] post_mutex_lock (?) 0x........ rc 0 owner 0
Invalid mutex
at 0x........: pthread_mutex_unlock (drd_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:125)
-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 ----------------
[1/1] mutex_init error checking mutex 0x........
------------ dealloc of mem holding locks ------------
[1/1] mutex_destroy error checking mutex 0x........
-[1/1] mutex_destroy invalid mutex 0x........
-[1/1] mutex_destroy invalid mutex 0x........
+[1/1] pre_mutex_lock (?) 0x........ rc 0 owner 0
[1/1] mutex_init recursive mutex 0x........
[1/1] post_mutex_lock recursive mutex 0x........ rc 0 owner 0
[1/1] mutex_unlock recursive mutex 0x........ rc 1
+[1/1] pre_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] post_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] mutex_unlock recursive mutex 0x........ rc 1
+[1/1] pre_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] post_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] mutex_unlock recursive mutex 0x........ rc 1
+[1/1] pre_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] post_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] mutex_unlock recursive mutex 0x........ rc 1
+[1/1] pre_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] post_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] mutex_unlock recursive mutex 0x........ rc 1
+[1/1] pre_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] post_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] mutex_unlock recursive mutex 0x........ rc 1
+[1/1] pre_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] post_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] mutex_unlock recursive mutex 0x........ rc 1
+[1/1] pre_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] post_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] mutex_unlock recursive mutex 0x........ rc 1
+[1/1] pre_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] post_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] mutex_unlock recursive mutex 0x........ rc 1
+[1/1] pre_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] post_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] mutex_unlock recursive mutex 0x........ rc 1
+[1/1] pre_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] post_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] mutex_unlock recursive mutex 0x........ rc 1
+[1/1] pre_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] post_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] mutex_unlock recursive mutex 0x........ rc 1
+[1/1] pre_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] post_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] mutex_unlock recursive mutex 0x........ rc 1
+[1/1] pre_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] post_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] mutex_unlock recursive mutex 0x........ rc 1
+[1/1] pre_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] post_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] mutex_unlock recursive mutex 0x........ rc 1
+[1/1] pre_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] post_mutex_lock recursive mutex 0x........ rc 0 owner 1
[1/1] mutex_unlock recursive mutex 0x........ rc 1
by 0x........: clone (in /...libc...)
Thread 1:
-Not a mutex
- at 0x........: pthread_cond_wait* (drd_intercepts.c:?)
- by 0x........: main (tc23_bogus_condwait.c:69)
-
-Not a mutex
- at 0x........: pthread_cond_wait* (drd_intercepts.c:?)
- by 0x........: main (tc23_bogus_condwait.c:69)
-
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)
by 0x........: start_thread (in libpthread-?.?.so)
by 0x........: clone (in /...libc...)
-ERROR SUMMARY: 11 errors from 11 contexts (suppressed: 0 from 0)
+ERROR SUMMARY: 9 errors from 9 contexts (suppressed: 0 from 0)