mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-04 02:18:37 +00:00
Resynchronized client requests with the latest version of TSan's header file
<dynamic_annotations.h>. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11096
This commit is contained in:
parent
080f6e814f
commit
d14798e66e
122
drd/drd.h
122
drd/drd.h
@ -127,6 +127,11 @@
|
||||
*/
|
||||
#define ANNOTATE_CONDVAR_SIGNAL(cv) do { } while(0)
|
||||
|
||||
/**
|
||||
* Tell DRD that the condition variable at address cv is about to be signaled.
|
||||
*/
|
||||
#define ANNOTATE_CONDVAR_SIGNAL_ALL(cv) do { } while(0)
|
||||
|
||||
/**
|
||||
* Tell DRD that waiting on condition variable at address cv succeeded and that
|
||||
* the memory operations performed after this annotation should be considered
|
||||
@ -136,6 +141,14 @@
|
||||
*/
|
||||
#define ANNOTATE_CONDVAR_WAIT(cv) do { } while(0)
|
||||
|
||||
/**
|
||||
* Tell DRD to consider the memory operations that happened before a mutex
|
||||
* unlock event and after the subsequent mutex lock event on the same mutex as
|
||||
* ordered. This is how DRD always behaves, so this macro has been defined
|
||||
* such that it has no effect.
|
||||
*/
|
||||
#define ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX(mtx) do { } while(0)
|
||||
|
||||
/** Deprecated -- don't use this annotation. */
|
||||
#define ANNOTATE_MUTEX_IS_USED_AS_CONDVAR(mtx) do { } while(0)
|
||||
|
||||
@ -198,6 +211,27 @@
|
||||
*/
|
||||
#define ANNOTATE_WRITERLOCK_RELEASED(rwlock) ANNOTATE_RWLOCK_RELEASED(rwlock, 1)
|
||||
|
||||
/*
|
||||
* Report that a barrier has been initialized with a given barrier count. The
|
||||
* third argument specifies whether or not reinitialization is allowed, that
|
||||
* is, whether or not it is allowed to call barrier_init() several times
|
||||
* without calling barrier_destroy().
|
||||
*/
|
||||
#define ANNOTATE_BARRIER_INIT(barrier, count, reinitialization_allowed) \
|
||||
DRDCL_(annotate_barrier_init)(barrier, count, reinitialization_allowed)
|
||||
|
||||
/* Report that a barrier has been destroyed. */
|
||||
#define ANNOTATE_BARRIER_DESTROY(barrier) \
|
||||
DRDCL_(annotate_barrier_destroy)(barrier)
|
||||
|
||||
/* Report that the calling thread is about to start waiting for a barrier. */
|
||||
#define ANNOTATE_BARRIER_WAIT_BEFORE(barrier) \
|
||||
DRDCL_(annotate_barrier_wait_before)(barrier)
|
||||
|
||||
/* Report that the calling thread has just finished waiting for a barrier. */
|
||||
#define ANNOTATE_BARRIER_WAIT_AFTER(barrier) \
|
||||
DRDCL_(annotate_barrier_wait_after)(barrier)
|
||||
|
||||
/**
|
||||
* Tell DRD that a FIFO queue has been created. The abbreviation PCQ stands for
|
||||
* <em>producer-consumer</em>.
|
||||
@ -230,6 +264,11 @@
|
||||
#define ANNOTATE_BENIGN_RACE(addr, descr) \
|
||||
DRDCL_(ignore_range)(addr, sizeof(*addr))
|
||||
|
||||
/* Same as ANNOTATE_BENIGN_RACE(address, description), but applies to
|
||||
the memory range [address, address+size). */
|
||||
#define ANNOTATE_BENIGN_RACE_SIZED(address, size, description) \
|
||||
DRDCL_(ignore_range)(addr, size)
|
||||
|
||||
/** Tell DRD to ignore all reads performed by the current thread. */
|
||||
#define ANNOTATE_IGNORE_READS_BEGIN() DRDCL_(set_record_loads)(0)
|
||||
|
||||
@ -317,6 +356,10 @@ enum {
|
||||
VG_USERREQ__DRD_SET_THREAD_NAME,
|
||||
/* args: null-terminated character string. */
|
||||
|
||||
/* Tell DRD that a DRD annotation has not yet been implemented. */
|
||||
VG_USERREQ__DRD_ANNOTATION_UNIMP,
|
||||
/* args: Char*. */
|
||||
|
||||
/* Tell DRD that a user-defined reader-writer synchronization object
|
||||
* has been created. */
|
||||
VG_USERREQ__DRD_ANNOTATE_RWLOCK_CREATE
|
||||
@ -338,8 +381,8 @@ enum {
|
||||
= VG_USERREQ_TOOL_BASE('H','G') + 256 + 18,
|
||||
/* args: Addr, Int is_rw. */
|
||||
|
||||
/* Tell DRD that an annotation has not yet been implemented. */
|
||||
VG_USERREQ__DRD_ANNOTATION_UNIMP
|
||||
/* Tell DRD that a Helgrind annotation has not yet been implemented. */
|
||||
VG_USERREQ__HELGRIND_ANNOTATION_UNIMP
|
||||
= VG_USERREQ_TOOL_BASE('H','G') + 256 + 32,
|
||||
/* args: Char*. */
|
||||
|
||||
@ -487,4 +530,79 @@ void DRDCL_(annotate_rwlock_released)(const void* const rwlock, const int is_w)
|
||||
rwlock, is_w, 0, 0, 0);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
void DRDCL_(annotate_barrier_init)(const void* barrier, const unsigned count,
|
||||
const int reinitialization_allowed)
|
||||
{
|
||||
int res;
|
||||
VALGRIND_DO_CLIENT_REQUEST(res, 0,
|
||||
VG_USERREQ__DRD_ANNOTATION_UNIMP,
|
||||
"ANNOTATE_BARRIER_INIT", 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
void DRDCL_(annotate_barrier_destroy)(const void* barrier)
|
||||
{
|
||||
int res;
|
||||
VALGRIND_DO_CLIENT_REQUEST(res, 0,
|
||||
VG_USERREQ__DRD_ANNOTATION_UNIMP,
|
||||
"ANNOTATE_BARRIER_DESTROY", 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
void DRDCL_(annotate_barrier_wait_before)(const void* barrier)
|
||||
{
|
||||
int res;
|
||||
VALGRIND_DO_CLIENT_REQUEST(res, 0,
|
||||
VG_USERREQ__DRD_ANNOTATION_UNIMP,
|
||||
"ANNOTATE_BARRIER_WAIT_BEFORE", 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
static __inline__
|
||||
void DRDCL_(annotate_barrier_wait_after)(const void* barrier)
|
||||
{
|
||||
int res;
|
||||
VALGRIND_DO_CLIENT_REQUEST(res, 0,
|
||||
VG_USERREQ__DRD_ANNOTATION_UNIMP,
|
||||
"ANNOTATE_BARRIER_WAIT_AFTER", 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @addtogroup RaceDetectionAnnotations
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* ANNOTATE_UNPROTECTED_READ is the preferred way to annotate racy reads.
|
||||
|
||||
Instead of doing
|
||||
ANNOTATE_IGNORE_READS_BEGIN();
|
||||
... = x;
|
||||
ANNOTATE_IGNORE_READS_END();
|
||||
one can use
|
||||
... = ANNOTATE_UNPROTECTED_READ(x); */
|
||||
template <typename T>
|
||||
inline T ANNOTATE_UNPROTECTED_READ(const volatile T& x) {
|
||||
ANNOTATE_IGNORE_READS_BEGIN();
|
||||
const T result = x;
|
||||
ANNOTATE_IGNORE_READS_END();
|
||||
return result;
|
||||
}
|
||||
/* Apply ANNOTATE_BENIGN_RACE_SIZED to a static variable. */
|
||||
#define ANNOTATE_BENIGN_RACE_STATIC(static_var, description) \
|
||||
namespace { \
|
||||
static class static_var##_annotator \
|
||||
{ \
|
||||
public: \
|
||||
static_var##_annotator() \
|
||||
{ \
|
||||
ANNOTATE_BENIGN_RACE(&static_var, #static_var ": " description); \
|
||||
} \
|
||||
} the_##static_var##_annotator; \
|
||||
}
|
||||
#endif
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* __VALGRIND_DRD_H */
|
||||
|
||||
@ -484,6 +484,21 @@ static Bool handle_client_request(ThreadId vg_tid, UWord* arg, UWord* ret)
|
||||
DRD_(clean_memory)(arg[1], arg[2]);
|
||||
break;
|
||||
|
||||
case VG_USERREQ__HELGRIND_ANNOTATION_UNIMP:
|
||||
{
|
||||
/* Note: it is assumed below that the text arg[1] points to is never
|
||||
* freed, e.g. because it points to static data.
|
||||
*/
|
||||
UnimpClReqInfo UICR =
|
||||
{ DRD_(thread_get_running_tid)(), (Char*)arg[1] };
|
||||
VG_(maybe_record_error)(vg_tid,
|
||||
UnimpHgClReq,
|
||||
VG_(get_IP)(vg_tid),
|
||||
"",
|
||||
&UICR);
|
||||
}
|
||||
break;
|
||||
|
||||
case VG_USERREQ__DRD_ANNOTATION_UNIMP:
|
||||
{
|
||||
/* Note: it is assumed below that the text arg[1] points to is never
|
||||
@ -492,7 +507,7 @@ static Bool handle_client_request(ThreadId vg_tid, UWord* arg, UWord* ret)
|
||||
UnimpClReqInfo UICR =
|
||||
{ DRD_(thread_get_running_tid)(), (Char*)arg[1] };
|
||||
VG_(maybe_record_error)(vg_tid,
|
||||
UnimpClReq,
|
||||
UnimpDrdClReq,
|
||||
VG_(get_IP)(vg_tid),
|
||||
"",
|
||||
&UICR);
|
||||
|
||||
@ -385,7 +385,7 @@ static void drd_tool_error_pp(Error* const e)
|
||||
VG_(pp_ExeContext)(VG_(get_error_where)(e));
|
||||
break;
|
||||
}
|
||||
case UnimpClReq: {
|
||||
case UnimpHgClReq: {
|
||||
UnimpClReqInfo* uicr =(UnimpClReqInfo*)(VG_(get_error_extra)(e));
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"The annotation macro %s has not yet been implemented in"
|
||||
@ -394,6 +394,15 @@ static void drd_tool_error_pp(Error* const e)
|
||||
VG_(pp_ExeContext)(VG_(get_error_where)(e));
|
||||
break;
|
||||
}
|
||||
case UnimpDrdClReq: {
|
||||
UnimpClReqInfo* uicr =(UnimpClReqInfo*)(VG_(get_error_extra)(e));
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"The annotation macro %s has not yet been implemented in"
|
||||
" <valgrind/drd.h>\n",
|
||||
uicr->descr);
|
||||
VG_(pp_ExeContext)(VG_(get_error_where)(e));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
VG_(message)(Vg_UserMsg,
|
||||
"%s\n",
|
||||
@ -431,7 +440,9 @@ static UInt drd_tool_error_update_extra(Error* e)
|
||||
return sizeof(GenericErrInfo);
|
||||
case InvalidThreadId:
|
||||
return sizeof(InvalidThreadIdInfo);
|
||||
case UnimpClReq:
|
||||
case UnimpHgClReq:
|
||||
return sizeof(UnimpClReqInfo);
|
||||
case UnimpDrdClReq:
|
||||
return sizeof(UnimpClReqInfo);
|
||||
default:
|
||||
tl_assert(False);
|
||||
@ -474,8 +485,10 @@ static Bool drd_is_recognized_suppression(Char* const name, Supp* const supp)
|
||||
skind = GenericErr;
|
||||
else if (VG_(strcmp)(name, STR_InvalidThreadId) == 0)
|
||||
skind = InvalidThreadId;
|
||||
else if (VG_(strcmp)(name, STR_UnimpClReq) == 0)
|
||||
skind = UnimpClReq;
|
||||
else if (VG_(strcmp)(name, STR_UnimpHgClReq) == 0)
|
||||
skind = UnimpHgClReq;
|
||||
else if (VG_(strcmp)(name, STR_UnimpDrdClReq) == 0)
|
||||
skind = UnimpDrdClReq;
|
||||
else
|
||||
return False;
|
||||
|
||||
@ -522,7 +535,8 @@ static Char* drd_get_error_name(Error* e)
|
||||
case HoldtimeErr: return VGAPPEND(STR_, HoldtimeErr);
|
||||
case GenericErr: return VGAPPEND(STR_, GenericErr);
|
||||
case InvalidThreadId: return VGAPPEND(STR_, InvalidThreadId);
|
||||
case UnimpClReq: return VGAPPEND(STR_, UnimpClReq);
|
||||
case UnimpHgClReq: return VGAPPEND(STR_, UnimpHgClReq);
|
||||
case UnimpDrdClReq: return VGAPPEND(STR_, UnimpDrdClReq);
|
||||
default:
|
||||
tl_assert(0);
|
||||
}
|
||||
|
||||
@ -61,8 +61,10 @@ typedef enum {
|
||||
GenericErr = 11,
|
||||
#define STR_InvalidThreadId "InvalidThreadId"
|
||||
InvalidThreadId = 12,
|
||||
#define STR_UnimpClReq "UnimpClReq"
|
||||
UnimpClReq = 13,
|
||||
#define STR_UnimpHgClReq "UnimpHgClReq"
|
||||
UnimpHgClReq = 13,
|
||||
#define STR_UnimpDrdClReq "UnimpDrdClReq"
|
||||
UnimpDrdClReq = 14,
|
||||
} DrdErrorKind;
|
||||
|
||||
/* The classification of a faulting address. */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user