if (mx->state == MX_Locked && mx->owner == tid) /* deadlock */
mutex_report(tid, mutexp, MXE_Deadlock, "trylocking");
- VG_TRACK( pre_mutex_lock, tid, (void *)mutexp );
+ VG_TRACK( pre_mutex_lock, tid, mutexp );
}
/* Give up waiting for a mutex. Fails if:
switch(mx->state) {
case MX_Unlocking: /* ownership transfer or relock */
- VG_TRACK( post_mutex_unlock, mx->owner, (void *)mutexp );
+ VG_TRACK( post_mutex_unlock, mx->owner, mutexp );
if (mx->owner != tid)
thread_unblock_mutex(tid, mx, "acquiring mutex");
break;
case MX_Locked:
if (debug_mutex)
VG_(printf)("mutex=%p mx->state=%s\n", mutexp, pp_mutexstate(mx));
- VG_TRACK( post_mutex_unlock, mx->owner, (void *)mutexp );
+ VG_TRACK( post_mutex_unlock, mx->owner, mutexp );
mutex_report(tid, mutexp, MXE_Locked, "acquiring");
thread_unblock_mutex(tid, mx, "acquiring mutex");
break;
mx->owner = tid;
mutex_setstate(tid, mx, MX_Locked);
- VG_TRACK( post_mutex_lock, tid, (void *)mutexp );
+ VG_TRACK( post_mutex_lock, tid, mutexp );
}
/* Try unlocking a lock. This will move it into a state where it can
case MX_Unlocking:
/* OK - we need to complete the unlock */
- VG_TRACK( post_mutex_unlock, tid, (void *)mutexp );
+ VG_TRACK( post_mutex_unlock, tid, mutexp );
mutex_setstate(tid, mx, MX_Free);
break;
DEF(track_post_thread_create, ThreadId, ThreadId)
DEF(track_post_thread_join, ThreadId, ThreadId)
-DEF(track_pre_mutex_lock, ThreadId, void*)
-DEF(track_post_mutex_lock, ThreadId, void*)
-DEF(track_post_mutex_unlock, ThreadId, void*)
+DEF(track_pre_mutex_lock, ThreadId, Addr)
+DEF(track_post_mutex_lock, ThreadId, Addr)
+DEF(track_post_mutex_unlock, ThreadId, Addr)
DEF(track_pre_deliver_signal, ThreadId, Int sigNo, Bool)
DEF(track_post_deliver_signal, ThreadId, Int sigNo)
void (*track_post_thread_create)(ThreadId, ThreadId);
void (*track_post_thread_join) (ThreadId, ThreadId);
- void (*track_pre_mutex_lock) (ThreadId, void*);
- void (*track_post_mutex_lock) (ThreadId, void*);
- void (*track_post_mutex_unlock)(ThreadId, void*);
+ void (*track_pre_mutex_lock) (ThreadId, Addr);
+ void (*track_post_mutex_lock) (ThreadId, Addr);
+ void (*track_post_mutex_unlock)(ThreadId, Addr);
void (*track_pre_deliver_signal) (ThreadId, Int sigNo, Bool);
void (*track_post_deliver_signal)(ThreadId, Int sigNo);
/* Do nothing */
}
-static void hg_pre_mutex_lock(ThreadId tid, void* void_mutex)
+static void hg_pre_mutex_lock(ThreadId tid, Addr client_mutex)
{
- Mutex *mutex = get_mutex((Addr)void_mutex);
+ Mutex *mutex = get_mutex(client_mutex);
test_mutex_state(mutex, MxLocked, tid);
}
-static void hg_post_mutex_lock(ThreadId tid, void* void_mutex)
+static void hg_post_mutex_lock(ThreadId tid, Addr client_mutex)
{
static const Bool debug = False;
- Mutex *mutex = get_mutex((Addr)void_mutex);
+ Mutex *mutex = get_mutex(client_mutex);
const LockSet* ls;
set_mutex_state(mutex, MxLocked, tid);
}
-static void hg_post_mutex_unlock(ThreadId tid, void* void_mutex)
+static void hg_post_mutex_unlock(ThreadId tid, Addr client_mutex)
{
static const Bool debug = False;
Int i = 0;
- Mutex *mutex = get_mutex((Addr)void_mutex);
+ Mutex *mutex = get_mutex(client_mutex);
const LockSet *ls;
test_mutex_state(mutex, MxUnlocked, tid);
static void bus_lock(void)
{
ThreadId tid = VG_(get_running_tid)();
- hg_pre_mutex_lock(tid, &__BUS_HARDWARE_LOCK__);
- hg_post_mutex_lock(tid, &__BUS_HARDWARE_LOCK__);
+ hg_pre_mutex_lock(tid, (Addr)&__BUS_HARDWARE_LOCK__);
+ hg_post_mutex_lock(tid, (Addr)&__BUS_HARDWARE_LOCK__);
}
static void bus_unlock(void)
{
ThreadId tid = VG_(get_running_tid)();
- hg_post_mutex_unlock(tid, &__BUS_HARDWARE_LOCK__);
+ hg_post_mutex_unlock(tid, (Addr)&__BUS_HARDWARE_LOCK__);
}
/*--------------------------------------------------------------------*/
/* The version number indicates binary-incompatible changes to the
interface; if the core and tool versions don't match, Valgrind
will abort. */
-#define VG_CORE_INTERFACE_VERSION 9
+#define VG_CORE_INTERFACE_VERSION 10
typedef struct _ToolInfo {
Int sizeof_ToolInfo;
Called before a thread can block while waiting for a mutex (called
regardless of whether the thread will block or not). */
-void VG_(track_pre_mutex_lock)(void(*f)(ThreadId tid, void* mutex));
+void VG_(track_pre_mutex_lock)(void(*f)(ThreadId tid, Addr mutex));
/* Called once the thread actually holds the mutex (always paired with
pre_mutex_lock). */
-void VG_(track_post_mutex_lock)(void(*f)(ThreadId tid, void* mutex));
+void VG_(track_post_mutex_lock)(void(*f)(ThreadId tid, Addr mutex));
/* Called after a thread has released a mutex (no need for a corresponding
pre_mutex_unlock, because unlocking can't block). */
-void VG_(track_post_mutex_unlock)(void(*f)(ThreadId tid, void* mutex));
+void VG_(track_post_mutex_unlock)(void(*f)(ThreadId tid, Addr mutex));
/* Signal events (not exhaustive)