{
if (s_mutex[i].mutex == 0)
{
+ if (drd_is_any_suppressed(mutex, mutex + size))
+ {
+ MutexErrInfo MEI = { 0, 0, 0 };
+ VG_(maybe_record_error)(VG_(get_running_tid)(),
+ MutexErr,
+ VG_(get_IP)(VG_(get_running_tid)()),
+ "Not a mutex",
+ &MEI);
+ return 0;
+ }
mutex_initialize(&s_mutex[i], mutex, size, mutex_type);
drd_start_suppression(mutex, mutex + size,
mutex_get_typename(&s_mutex[i]));
{
const DrdThreadId drd_tid = VgThreadIdToDrdThreadId(VG_(get_running_tid)());
struct mutex_info* const p = mutex_get_or_allocate(mutex, size, mutex_type);
- const DrdThreadId last_owner = p->owner;
if (s_trace_mutex)
{
p ? p->owner : VG_INVALID_THREADID);
}
+ if (p == 0)
+ {
+ MutexErrInfo MEI = { 0, 0, 0 };
+ VG_(maybe_record_error)(VG_(get_running_tid)(),
+ MutexErr,
+ VG_(get_IP)(VG_(get_running_tid)()),
+ "Not a mutex",
+ &MEI);
+ return 0;
+ }
+
tl_assert(mutex_type == mutex_type_mutex
|| mutex_type == mutex_type_spinlock);
tl_assert(p->mutex_type == mutex_type);
if (p->recursion_count == 1)
{
+ const DrdThreadId last_owner = p->owner;
+
if (last_owner != drd_tid && last_owner != DRD_INVALID_THREADID)
thread_combine_vc2(drd_tid, mutex_get_last_vc(mutex));
thread_new_segment(drd_tid);
p->owner);
}
+ if (p == 0 || p->owner == DRD_INVALID_THREADID)
+ {
+ MutexErrInfo MEI = { 0, 0, 0 };
+ VG_(maybe_record_error)(vg_tid,
+ MutexErr,
+ VG_(get_IP)(vg_tid),
+ "Not a mutex",
+ &MEI);
+ return 0;
+ }
+
tl_assert(p);
tl_assert(p->mutex_type == mutex_type);
tl_assert(p->owner != DRD_INVALID_THREADID);
Bool mutex_is_locked_by(const Addr mutex, const DrdThreadId tid)
{
struct mutex_info* const p = mutex_get(mutex);
- tl_assert(p);
if (p)
{
return (p->recursion_count > 0 && p->owner == tid);