Reorganized error printing code slightly.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7758
This commit is contained in:
Bart Van Assche 2008-03-23 07:54:02 +00:00
parent 0ababebf5b
commit d1e56ca05d
2 changed files with 37 additions and 21 deletions

View File

@ -39,13 +39,6 @@
#include "pub_tool_tooliface.h" // VG_(needs_tool_errors)()
/* Local type definitions. */
typedef enum {
ConflictingAccessSupp
} DRD_SuppKind;
/* Local variables. */
static Bool s_drd_show_conflicting_segments = True;
@ -253,12 +246,26 @@ static UInt drd_tool_error_update_extra(Error* e)
static Bool drd_tool_error_recog(Char* const name, Supp* const supp)
{
SuppKind skind;
SuppKind skind = 0;
if (VG_(strcmp)(name, "ConflictingAccess") == 0)
skind = ConflictingAccessSupp;
else if (VG_(strcmp)(name, "CondErr") == 0)
skind = CondErr;
if (VG_(strcmp)(name, STR_DataRaceErr) == 0)
;
else if (VG_(strcmp)(name, STR_MutexErr) == 0)
;
else if (VG_(strcmp)(name, STR_CondErr) == 0)
;
else if (VG_(strcmp)(name, STR_CondRaceErr) == 0)
;
else if (VG_(strcmp)(name, STR_CondDestrErr) == 0)
;
else if (VG_(strcmp)(name, STR_SemaphoreErr) == 0)
;
else if (VG_(strcmp)(name, STR_BarrierErr) == 0)
;
else if (VG_(strcmp)(name, STR_RwlockErr) == 0)
;
else if (VG_(strcmp)(name, STR_GenericErr) == 0)
;
else
return False;
@ -283,15 +290,15 @@ static Char* drd_tool_error_name(Error* e)
{
switch (VG_(get_error_kind)(e))
{
case DataRaceErr: return "ConflictingAccess";
case MutexErr: return "MutexErr";
case CondErr: return "CondErr";
case CondRaceErr: return "CondRaceErr";
case CondDestrErr: return "CondDestrErr";
case SemaphoreErr: return "SemaphoreErr";
case BarrierErr: return "BarrierErr";
case RwlockErr: return "RwlockErr";
case GenericErr: return "GenericErr";
case DataRaceErr: return VGAPPEND(STR_, DataRaceErr);
case MutexErr: return VGAPPEND(STR_, MutexErr);
case CondErr: return VGAPPEND(STR_, CondErr);
case CondRaceErr: return VGAPPEND(STR_, CondRaceErr);
case CondDestrErr: return VGAPPEND(STR_, CondDestrErr);
case SemaphoreErr: return VGAPPEND(STR_, SemaphoreErr);
case BarrierErr: return VGAPPEND(STR_, BarrierErr);
case RwlockErr: return VGAPPEND(STR_, RwlockErr);
case GenericErr: return VGAPPEND(STR_, GenericErr);
default:
tl_assert(0);
}

View File

@ -37,14 +37,23 @@
/* DRD error types. */
typedef enum {
#define STR_DataRaceErr "ConflictingAccess"
DataRaceErr = 1,
#define STR_MutexErr "MutexErr"
MutexErr = 2,
#define STR_CondErr "CondErr"
CondErr = 3,
#define STR_CondRaceErr "CondRaceErr"
CondRaceErr = 4,
#define STR_CondDestrErr "CondDestrErr"
CondDestrErr = 5,
#define STR_SemaphoreErr "SemaphoreErr"
SemaphoreErr = 6,
#define STR_BarrierErr "BarrierErr"
BarrierErr = 7,
#define STR_RwlockErr "RwlockErr"
RwlockErr = 8,
#define STR_GenericErr "GenericErr"
GenericErr = 9,
} DrdErrorKind;