|
From: <sv...@va...> - 2008-03-24 11:55:17
|
Author: bart
Date: 2008-03-24 11:54:47 +0000 (Mon, 24 Mar 2008)
New Revision: 7777
Log:
Merged from trunk to DRDDEV branch.
Modified:
branches/DRDDEV/exp-drd/drd_error.c
branches/DRDDEV/exp-drd/drd_mutex.c
Modified: branches/DRDDEV/exp-drd/drd_error.c
===================================================================
--- branches/DRDDEV/exp-drd/drd_error.c 2008-03-24 11:02:05 UTC (rev 7776)
+++ branches/DRDDEV/exp-drd/drd_error.c 2008-03-24 11:54:47 UTC (rev 7777)
@@ -133,12 +133,22 @@
case MutexErr: {
MutexErrInfo* p = (MutexErrInfo*)(VG_(get_error_extra)(e));
tl_assert(p);
- VG_(message)(Vg_UserMsg,
- "%s: mutex 0x%lx, recursion count %d, owner %d.",
- VG_(get_error_string)(e),
- p->mutex,
- p->recursion_count,
- p->owner);
+ if (p->recursion_count >= 0)
+ {
+ VG_(message)(Vg_UserMsg,
+ "%s: mutex 0x%lx, recursion count %d, owner %d.",
+ VG_(get_error_string)(e),
+ p->mutex,
+ p->recursion_count,
+ p->owner);
+ }
+ else
+ {
+ VG_(message)(Vg_UserMsg,
+ "%s: mutex 0x%lx.",
+ VG_(get_error_string)(e),
+ p->mutex);
+ }
VG_(pp_ExeContext)(VG_(get_error_where)(e));
break;
}
Modified: branches/DRDDEV/exp-drd/drd_mutex.c
===================================================================
--- branches/DRDDEV/exp-drd/drd_mutex.c 2008-03-24 11:02:05 UTC (rev 7776)
+++ branches/DRDDEV/exp-drd/drd_mutex.c 2008-03-24 11:54:47 UTC (rev 7777)
@@ -72,6 +72,8 @@
/** Deallocate the memory that was allocated by mutex_initialize(). */
static void mutex_cleanup(struct mutex_info* p)
{
+ tl_assert(p);
+
if (s_trace_mutex)
{
VG_(message)(Vg_UserMsg,
@@ -96,6 +98,16 @@
p->last_locked_segment = 0;
}
+static void not_a_mutex(const Addr mutex)
+{
+ MutexErrInfo MEI = { mutex, -1, DRD_INVALID_THREADID };
+ VG_(maybe_record_error)(VG_(get_running_tid)(),
+ MutexErr,
+ VG_(get_IP)(VG_(get_running_tid)()),
+ "Not a mutex",
+ &MEI);
+}
+
static
struct mutex_info*
mutex_get_or_allocate(const Addr mutex, const MutexT mutex_type)
@@ -111,12 +123,7 @@
if (clientobj_present(mutex, mutex + 1))
{
- GenericErrInfo GEI;
- VG_(maybe_record_error)(VG_(get_running_tid)(),
- GenericErr,
- VG_(get_IP)(VG_(get_running_tid)()),
- "Not a mutex",
- &GEI);
+ not_a_mutex(mutex);
return 0;
}
@@ -149,12 +156,7 @@
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)()),
- "Not a mutex",
- &GEI);
+ not_a_mutex(mutex);
return 0;
}
@@ -184,12 +186,7 @@
p = mutex_get(mutex);
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);
+ not_a_mutex(mutex);
return;
}
@@ -213,7 +210,7 @@
"[%d/%d] pre_mutex_lock %s 0x%lx rc %d owner %d",
VG_(get_running_tid)(),
thread_get_running_tid(),
- mutex_get_typename(p),
+ p ? mutex_get_typename(p) : "(?)",
mutex,
p ? p->recursion_count : -1,
p ? p->owner : DRD_INVALID_THREADID);
@@ -221,12 +218,7 @@
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);
+ not_a_mutex(mutex);
return;
}
@@ -234,12 +226,7 @@
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)()),
- "Not a mutex",
- &GEI);
+ not_a_mutex(mutex);
return;
}
@@ -331,19 +318,14 @@
"[%d/%d] mutex_unlock %s 0x%lx rc %d",
vg_tid,
drd_tid,
- p ? mutex_get_typename(p) : "?",
+ p ? mutex_get_typename(p) : "(?)",
mutex,
p ? p->recursion_count : 0);
}
if (p == 0 || mutex_type == mutex_type_invalid_mutex)
{
- GenericErrInfo GEI;
- VG_(maybe_record_error)(vg_tid,
- GenericErr,
- VG_(get_IP)(vg_tid),
- "Not a mutex",
- &GEI);
+ not_a_mutex(mutex);
return;
}
|