Cleaned up generation of "Not a mutex" error messages.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7483
This commit is contained in:
Bart Van Assche 2008-02-26 19:13:04 +00:00
parent f3439bbf39
commit cd8ef39ca8
10 changed files with 38 additions and 27 deletions

View File

@ -259,12 +259,13 @@ static void drd_tool_error_pp(Error* const e)
}
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 ? p->mutex : 0,
p ? p->recursion_count : 0,
p ? p->owner : DRD_INVALID_THREADID);
p->mutex,
p->recursion_count,
p->owner);
VG_(pp_ExeContext)(VG_(get_error_where)(e));
break;
}
@ -287,6 +288,12 @@ static void drd_tool_error_pp(Error* const e)
VG_(pp_ExeContext)(VG_(get_error_where)(e));
break;
}
case GenericErr: {
//GenericErrInfo* gei =(GenericErrInfo*)(VG_(get_error_extra)(e));
VG_(message)(Vg_UserMsg, "%s", VG_(get_error_string)(e));
VG_(pp_ExeContext)(VG_(get_error_where)(e));
break;
}
default:
VG_(message)(Vg_UserMsg,
"%s",
@ -308,6 +315,8 @@ static UInt drd_tool_error_update_extra(Error* e)
return sizeof(CondRaceErrInfo);
case CondErr:
return sizeof(CondErrInfo);
case GenericErr:
return sizeof(GenericErrInfo);
default:
tl_assert(False);
break;

View File

@ -40,7 +40,8 @@ typedef enum {
DataRaceErr = 1,
MutexErr = 2,
CondRaceErr = 3,
CondErr = 4,
CondErr = 4,
GenericErr = 5,
} DrdErrorKind;
/* The classification of a faulting address. */
@ -94,6 +95,9 @@ typedef struct {
Addr cond;
} CondErrInfo;
typedef struct {
} GenericErrInfo;
void describe_addr(Addr const a, SizeT const len, AddrInfo* const ai);
Char* describe_addr_text(Addr const a, SizeT const len, AddrInfo* const ai,
Char* const buf, UInt const n_buf);

View File

@ -112,12 +112,12 @@ mutex_get_or_allocate(const Addr mutex,
{
if (drd_is_any_suppressed(mutex, mutex + size))
{
MutexErrInfo MEI = { 0, 0, 0 };
GenericErrInfo GEI;
VG_(maybe_record_error)(VG_(get_running_tid)(),
MutexErr,
GenericErr,
VG_(get_IP)(VG_(get_running_tid)()),
"Not a mutex",
&MEI);
&GEI);
return 0;
}
mutex_initialize(&s_mutex[i], mutex, size, mutex_type);
@ -246,12 +246,12 @@ int mutex_lock(const Addr mutex, const SizeT size, MutexT mutex_type)
if (p == 0)
{
MutexErrInfo MEI = { 0, 0, 0 };
GenericErrInfo GEI;
VG_(maybe_record_error)(VG_(get_running_tid)(),
MutexErr,
GenericErr,
VG_(get_IP)(VG_(get_running_tid)()),
"Not a mutex",
&MEI);
&GEI);
return 0;
}
@ -323,12 +323,12 @@ int mutex_unlock(const Addr mutex, const MutexT mutex_type)
if (p == 0 || p->owner == DRD_INVALID_THREADID)
{
MutexErrInfo MEI = { 0, 0, 0 };
GenericErrInfo GEI;
VG_(maybe_record_error)(vg_tid,
MutexErr,
GenericErr,
VG_(get_IP)(vg_tid),
"Not a mutex",
&MEI);
&GEI);
return 0;
}

View File

@ -0,0 +1 @@
ERROR SUMMARY: 4 errors from 4 contexts

View File

@ -1 +0,0 @@
prog: tc07_hbl1

View File

@ -1,2 +0,0 @@
prog: tc08_hbl2
stderr_filter: filter_error_summary

View File

@ -13,7 +13,7 @@ Mutex not unlocked by owner thread / mutex 0x........ (recursion count 1, owner
by 0x........: clone (in /...libc...)
Thread 1:
Not a mutex / mutex 0x........ (recursion count 0, owner 0)
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)
@ -32,7 +32,7 @@ Mutex not unlocked by owner thread / mutex 0x........ (recursion count 1, owner
by 0x........: clone (in /...libc...)
Thread 1:
Not a mutex / mutex 0x........ (recursion count 0, owner 0)
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)

View File

@ -20,14 +20,14 @@ Destroying locked mutex / mutex 0x........ (recursion count 1, owner 1)
at 0x........: pthread_mutex_destroy (drd_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:102)
Not a mutex / mutex 0x........ (recursion count 0, owner 0)
Not a mutex
at 0x........: pthread_mutex_unlock (drd_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:125)
---------------- pthread_cond_wait et al ----------------
Not a mutex / mutex 0x........ (recursion count 0, owner 0)
Not a mutex
at 0x........: pthread_cond_wait* (drd_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:147)

View File

@ -20,14 +20,14 @@ Destroying locked mutex / mutex 0x........ (recursion count 1, owner 1)
at 0x........: pthread_mutex_destroy (drd_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:102)
Not a mutex / mutex 0x........ (recursion count 0, owner 0)
Not a mutex
at 0x........: pthread_mutex_unlock (drd_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:125)
---------------- pthread_cond_wait et al ----------------
Not a mutex / mutex 0x........ (recursion count 0, owner 0)
Not a mutex
at 0x........: pthread_cond_wait* (drd_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:147)

View File

@ -1,5 +1,5 @@
Not a mutex / mutex 0x........ (recursion count 0, owner 0)
Not a mutex
at 0x........: pthread_cond_wait* (drd_intercepts.c:?)
by 0x........: main (tc23_bogus_condwait.c:69)
@ -12,15 +12,15 @@ Race condition: condition variable 0x........ has been signalled but the associa
by 0x........: clone (in /...libc...)
Thread 1:
Not a mutex / mutex 0x........ (recursion count 0, owner 0)
Not a mutex
at 0x........: pthread_cond_wait* (drd_intercepts.c:?)
by 0x........: main (tc23_bogus_condwait.c:69)
Not a mutex / mutex 0x........ (recursion count 0, owner 0)
Not a mutex
at 0x........: pthread_cond_wait* (drd_intercepts.c:?)
by 0x........: main (tc23_bogus_condwait.c:69)
Not a mutex / mutex 0x........ (recursion count 0, owner 0)
Not a mutex
at 0x........: pthread_cond_wait* (drd_intercepts.c:?)
by 0x........: main (tc23_bogus_condwait.c:72)
@ -33,7 +33,7 @@ Race condition: condition variable 0x........ has been signalled but the associa
by 0x........: clone (in /...libc...)
Thread 1:
Not a mutex / mutex 0x........ (recursion count 0, owner 0)
Not a mutex
at 0x........: pthread_cond_wait* (drd_intercepts.c:?)
by 0x........: main (tc23_bogus_condwait.c:75)