]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
drd.h: removed inline functions and replaced these by direct client request invocations.
authorBart Van Assche <bvanassche@acm.org>
Thu, 2 Sep 2010 09:38:55 +0000 (09:38 +0000)
committerBart Van Assche <bvanassche@acm.org>
Thu, 2 Sep 2010 09:38:55 +0000 (09:38 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11318

drd/drd.h
drd/tests/annotate_barrier.stderr.exp
drd/tests/annotate_hb_err.c
drd/tests/annotate_hb_err.stderr.exp
drd/tests/annotate_hb_race.c
drd/tests/rwlock_type_checking.stderr.exp
drd/tests/tsan_thread_wrappers_pthread.h
drd/tests/unified_annotations.h

index d8060e740905a7c3634004c89a7ac3c72c9c7dac..93d35e502edce59334d6fe788da65cf1c082c497 100644 (file)
--- a/drd/drd.h
+++ b/drd/drd.h
 #include "valgrind.h"
 
 
-/** Prefix for the (inline) functions defined in this header file. */
-#define DRDCL_(str) vgDrdCl_##str
-
-
 /** Obtain the thread ID assigned by Valgrind's core. */
-#define DRD_GET_VALGRIND_THREADID (DRDCL_(get_valgrind_threadid)())
+#define DRD_GET_VALGRIND_THREADID                                             \
+   VALGRIND_DO_CLIENT_REQUEST_EXPR(0, VG_USERREQ__DRD_GET_VALGRIND_THREAD_ID, \
+                                   0, 0, 0, 0, 0)
 
 /** Obtain the thread ID assigned by DRD. */
-#define DRD_GET_DRD_THREADID (DRDCL_(get_drd_threadid)())
+#define DRD_GET_DRD_THREADID                                              \
+   VALGRIND_DO_CLIENT_REQUEST_EXPR(0, VG_USERREQ__DRD_GET_DRD_THREAD_ID,  \
+                                   0, 0, 0, 0, 0)
+
 
 /** Tell DRD not to complain about data races for the specified variable. */
-#define DRD_IGNORE_VAR(x) DRDCL_(ignore_range)(&(x), sizeof(x))
+#define DRD_IGNORE_VAR(x) ANNOTATE_BENIGN_RACE_SIZED(&(x), sizeof(x), "")
 
 /** Tell DRD to no longer ignore data races for the specified variable. */
-#define DRD_STOP_IGNORING_VAR(x) DRDCL_(ignore_range)(&(x), sizeof(x))
+#define DRD_STOP_IGNORING_VAR(x)                                           \
+   VALGRIND_DO_CLIENT_REQUEST_EXPR(0, VG_USERREQ__DRD_FINISH_SUPPRESSION,  \
+                                   &(x), sizeof(x), 0, 0, 0)
 
 /**
  * Tell DRD to trace all memory accesses on the specified variable.
  * until the memory that was allocated for the variable is freed.
  */
-#define DRD_TRACE_VAR(x) DRDCL_(trace_range)(&(x), sizeof(x))
+#define DRD_TRACE_VAR(x)                                                 \
+   VALGRIND_DO_CLIENT_REQUEST_EXPR(0, VG_USERREQ__DRD_START_TRACE_ADDR,  \
+                                   &(x), sizeof(x), 0, 0, 0)
 
 /**
  * @defgroup RaceDetectionAnnotations Data race detection annotations.
  * Tell DRD to insert a happens-before mark. addr is the address of an object
  * that is not a pthread synchronization object.
  */
-#define ANNOTATE_HAPPENS_BEFORE(addr) DRDCL_(annotate_happens_before)(addr)
+#define ANNOTATE_HAPPENS_BEFORE(addr)                                        \
+   VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                                        \
+                                   VG_USERREQ__DRD_ANNOTATE_HAPPENS_BEFORE,  \
+                                   addr, 0, 0, 0, 0)
 
 /**
  * Tell DRD that the memory accesses executed after this annotation will
  * before any other thread has passed by a happens-before annotation for the
  * same address is an error.
  */
-#define ANNOTATE_HAPPENS_AFTER(addr) DRDCL_(annotate_happens_after)(addr)
+#define ANNOTATE_HAPPENS_AFTER(addr)                                        \
+   VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                                       \
+                                   VG_USERREQ__DRD_ANNOTATE_HAPPENS_AFTER,  \
+                                   addr, 0, 0, 0, 0)
 
 /**
  * Tell DRD that waiting on the condition variable at address cv has succeeded
 #define ANNOTATE_SWAP_MEMORY_RANGE(addr, size) do { } while(0)
 
 /** Tell DRD that a reader-writer lock object has been initialized. */
-#define ANNOTATE_RWLOCK_CREATE(rwlock) \
-   DRDCL_(annotate_rwlock_create)(rwlock)
+#define ANNOTATE_RWLOCK_CREATE(rwlock)                                      \
+   VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                                       \
+                                   VG_USERREQ__DRD_ANNOTATE_RWLOCK_CREATE,  \
+                                   rwlock, 0, 0, 0, 0);
 
 /** Tell DRD that a reader-writer lock object has been destroyed. */
-#define ANNOTATE_RWLOCK_DESTROY(rwlock) \
-   DRDCL_(annotate_rwlock_destroy)(rwlock)
+#define ANNOTATE_RWLOCK_DESTROY(rwlock)                                      \
+   VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                                        \
+                                   VG_USERREQ__DRD_ANNOTATE_RWLOCK_DESTROY,  \
+                                   rwlock, 0, 0, 0, 0);
 
 /**
  * Tell DRD that a reader-writer lock has been acquired. is_w == 1 means that
  * a write lock has been obtained, is_w == 0 means that a read lock has been
  * obtained.
  */
-#define ANNOTATE_RWLOCK_ACQUIRED(rwlock, is_w) \
-   DRDCL_(annotate_rwlock_acquired)(rwlock, is_w)
+#define ANNOTATE_RWLOCK_ACQUIRED(rwlock, is_w)                                \
+   VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                                         \
+                                   VG_USERREQ__DRD_ANNOTATE_RWLOCK_ACQUIRED,  \
+                                   rwlock, is_w, 0, 0, 0)
 
 /**
  * Tell DRD that a reader lock has been acquired on a reader-writer
  * that a write lock is about to be released, is_w == 0 means that a read lock
  * is about to be released.
  */
-#define ANNOTATE_RWLOCK_RELEASED(rwlock, is_w) \
-   DRDCL_(annotate_rwlock_released)(rwlock, is_w)
+#define ANNOTATE_RWLOCK_RELEASED(rwlock, is_w)                               \
+   VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                                        \
+                                   VG_USERREQ__DRD_ANNOTATE_RWLOCK_RELEASED, \
+                                   rwlock, is_w, 0, 0, 0);
 
 /**
  * Tell DRD that a reader lock is about to be released.
  * 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)
+#define ANNOTATE_BARRIER_INIT(barrier, count, reinitialization_allowed)  \
+   VALGRIND_DO_CLIENT_REQUEST_EXPR(0, VG_USERREQ__DRD_ANNOTATION_UNIMP,  \
+                                   "ANNOTATE_BARRIER_INIT", barrier,     \
+                                   count, reinitialization_allowed, 0)
 
 /* Report that a barrier has been destroyed. */
-#define ANNOTATE_BARRIER_DESTROY(barrier)      \
-   DRDCL_(annotate_barrier_destroy)(barrier)
+#define ANNOTATE_BARRIER_DESTROY(barrier)                                   \
+   VALGRIND_DO_CLIENT_REQUEST_EXPR(0, VG_USERREQ__DRD_ANNOTATION_UNIMP,  \
+                                   "ANNOTATE_BARRIER_DESTROY",           \
+                                   barrier, 0, 0, 0)
 
 /* 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)
+#define ANNOTATE_BARRIER_WAIT_BEFORE(barrier)                               \
+   VALGRIND_DO_CLIENT_REQUEST_EXPR(0, VG_USERREQ__DRD_ANNOTATION_UNIMP,  \
+                                   "ANNOTATE_BARRIER_WAIT_BEFORE",       \
+                                   barrier, 0, 0, 0)
 
 /* Report that the calling thread has just finished waiting for a barrier. */
-#define ANNOTATE_BARRIER_WAIT_AFTER(barrier)   \
-   DRDCL_(annotate_barrier_wait_after)(barrier)
+#define ANNOTATE_BARRIER_WAIT_AFTER(barrier)                            \
+   VALGRIND_DO_CLIENT_REQUEST_EXPR(0, VG_USERREQ__DRD_ANNOTATION_UNIMP,  \
+                                   "ANNOTATE_BARRIER_WAIT_AFTER",        \
+                                   barrier, 0, 0, 0)
 
 /**
  * Tell DRD that a FIFO queue has been created. The abbreviation PCQ stands for
  * be reported.
  */
 #define ANNOTATE_BENIGN_RACE(addr, descr) \
-   DRDCL_(ignore_range)(addr, sizeof(*addr))
+   ANNOTATE_BENIGN_RACE_SIZED(addr, sizeof(*addr), descr)
 
-/* 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)
+/* Same as ANNOTATE_BENIGN_RACE(addr, descr), but applies to
+   the memory range [addr, addr + size). */
+#define ANNOTATE_BENIGN_RACE_SIZED(addr, size, descr)                    \
+   VALGRIND_DO_CLIENT_REQUEST_EXPR(0, VG_USERREQ__DRD_START_SUPPRESSION,  \
+                                   addr, size, 0, 0, 0)
 
 /** Tell DRD to ignore all reads performed by the current thread. */
-#define ANNOTATE_IGNORE_READS_BEGIN() DRDCL_(set_record_loads)(0)
+#define ANNOTATE_IGNORE_READS_BEGIN()                                \
+   VALGRIND_DO_CLIENT_REQUEST_EXPR(0, VG_USERREQ__DRD_RECORD_LOADS,  \
+                                   0, 0, 0, 0, 0);
+
 
 /** Tell DRD to no longer ignore the reads performed by the current thread. */
-#define ANNOTATE_IGNORE_READS_END() DRDCL_(set_record_loads)(1)
+#define ANNOTATE_IGNORE_READS_END()                                  \
+   VALGRIND_DO_CLIENT_REQUEST_EXPR(0, VG_USERREQ__DRD_RECORD_LOADS,  \
+                                   1, 0, 0, 0, 0);
 
 /** Tell DRD to ignore all writes performed by the current thread. */
-#define ANNOTATE_IGNORE_WRITES_BEGIN() DRDCL_(set_record_stores)(0)
+#define ANNOTATE_IGNORE_WRITES_BEGIN()                                \
+   VALGRIND_DO_CLIENT_REQUEST_EXPR(0, VG_USERREQ__DRD_RECORD_STORES,  \
+                                   0, 0, 0, 0, 0)
 
 /** Tell DRD to no longer ignore the writes performed by the current thread. */
-#define ANNOTATE_IGNORE_WRITES_END() DRDCL_(set_record_stores)(1)
+#define ANNOTATE_IGNORE_WRITES_END()                                  \
+   VALGRIND_DO_CLIENT_REQUEST_EXPR(0, VG_USERREQ__DRD_RECORD_STORES,  \
+                                   1, 0, 0, 0, 0)
 
 /** Tell DRD to ignore all memory accesses performed by the current thread. */
 #define ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN() \
-   do { DRDCL_(set_record_loads)(0); DRDCL_(set_record_stores)(0); } while(0)
+   do { ANNOTATE_IGNORE_READS_BEGIN(); ANNOTATE_IGNORE_WRITES_BEGIN(); } while(0)
 
 /**
  * Tell DRD to no longer ignore the memory accesses performed by the current
  * thread.
  */
 #define ANNOTATE_IGNORE_READS_AND_WRITES_END() \
-   do { DRDCL_(set_record_loads)(1); DRDCL_(set_record_stores)(1); } while(0)
+   do { ANNOTATE_IGNORE_READS_END(); ANNOTATE_IGNORE_WRITES_END(); } while(0)
 
 /**
  * Tell DRD that size bytes starting at addr has been allocated by a custom
  * memory allocator.
  */
-#define ANNOTATE_NEW_MEMORY(addr, size) DRDCL_(clean_memory)(addr, size)
+#define ANNOTATE_NEW_MEMORY(addr, size)                              \
+   VALGRIND_DO_CLIENT_REQUEST_EXPR(0, VG_USERREQ__DRD_CLEAN_MEMORY,  \
+                                   addr, size, 0, 0, 0)
 
-/** Ask DRD to report every access to the specified address range. */
-#define ANNOTATE_TRACE_MEMORY(addr) DRDCL_(trace_range)(addr, 1)
+/** Ask DRD to report every access to the specified address. */
+#define ANNOTATE_TRACE_MEMORY(addr) DRD_TRACE_VAR(*(char*)(addr))
 
 /**
  * Tell DRD to assign the specified name to the current thread. This name will
  * be used in error messages printed by DRD.
  */
-#define ANNOTATE_THREAD_NAME(name) DRDCL_(set_thread_name)(name)
+#define ANNOTATE_THREAD_NAME(name)                                      \
+   VALGRIND_DO_CLIENT_REQUEST_EXPR(0, VG_USERREQ__DRD_SET_THREAD_NAME,  \
+                                   name, 0, 0, 0, 0)
 
 /*@}*/
 
@@ -398,272 +439,6 @@ enum {
 };
 
 
-/*
- * Do not call the inline functions below directly but use the macro's defined
- * above. The names of these inline functions may change from one release to
- * another.
- */
-
-static
-#ifdef _MSC_VER
-__inline
-#else
-__inline__
-#endif
-void DRDCL_(clean_memory)(const void* const addr, const int size)
-{
-   int res;
-   VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_CLEAN_MEMORY,
-                              addr, size, 0, 0, 0);
-}
-
-static
-#ifdef _MSC_VER
-__inline
-#else
-__inline__
-#endif
-int DRDCL_(get_valgrind_threadid)(void)
-{
-   int res;
-   VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_GET_VALGRIND_THREAD_ID,
-                              0, 0, 0, 0, 0);
-   return res;
-}
-
-static
-#ifdef _MSC_VER
-__inline
-#else
-__inline__
-#endif
-int DRDCL_(get_drd_threadid)(void)
-{
-   int res;
-   VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_GET_DRD_THREAD_ID,
-                              0, 0, 0, 0, 0);
-   return res;
-}
-
-static
-#ifdef _MSC_VER
-__inline
-#else
-__inline__
-#endif
-void DRDCL_(ignore_range)(const void* const addr, const int size)
-{
-   int res;
-   VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_START_SUPPRESSION,
-                              addr, size, 0, 0, 0);
-}
-
-static
-#ifdef _MSC_VER
-__inline
-#else
-__inline__
-#endif
-void DRDCL_(stop_ignoring_range)(const void* const addr, const int size)
-{
-   int res;
-   VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_FINISH_SUPPRESSION,
-                              addr, size, 0, 0, 0);
-}
-
-static
-#ifdef _MSC_VER
-__inline
-#else
-__inline__
-#endif
-void DRDCL_(trace_range)(const void* const addr, const int size)
-{
-   int res;
-   VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_START_TRACE_ADDR,
-                              addr, size, 0, 0, 0);
-}
-
-static
-#ifdef _MSC_VER
-__inline
-#else
-__inline__
-#endif
-void DRDCL_(set_record_loads)(const int enabled)
-{
-   int res;
-   VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_RECORD_LOADS,
-                              enabled, 0, 0, 0, 0);
-}
-
-static
-#ifdef _MSC_VER
-__inline
-#else
-__inline__
-#endif
-void DRDCL_(set_record_stores)(const int enabled)
-{
-   int res;
-   VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_RECORD_STORES,
-                              enabled, 0, 0, 0, 0);
-}
-
-static
-#ifdef _MSC_VER
-__inline
-#else
-__inline__
-#endif
-void DRDCL_(set_thread_name)(const char* const name)
-{
-   int res;
-   VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_SET_THREAD_NAME,
-                              name, 0, 0, 0, 0);
-}
-
-static
-#ifdef _MSC_VER
-__inline
-#else
-__inline__
-#endif
-void DRDCL_(annotate_happens_before)(const void* const addr)
-{
-   int res;
-   VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_ANNOTATE_HAPPENS_BEFORE,
-                              addr, 0, 0, 0, 0);
-}
-
-static
-#ifdef _MSC_VER
-__inline
-#else
-__inline__
-#endif
-void DRDCL_(annotate_happens_after)(const void* const addr)
-{
-   int res;
-   VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_ANNOTATE_HAPPENS_AFTER,
-                              addr, 0, 0, 0, 0);
-}
-
-static
-#ifdef _MSC_VER
-__inline
-#else
-__inline__
-#endif
-void DRDCL_(annotate_rwlock_create)(const void* const rwlock)
-{
-   int res;
-   VALGRIND_DO_CLIENT_REQUEST(res, 0,
-                              VG_USERREQ__DRD_ANNOTATE_RWLOCK_CREATE,
-                              rwlock, 0, 0, 0, 0);
-}
-
-static
-#ifdef _MSC_VER
-__inline
-#else
-__inline__
-#endif
-void DRDCL_(annotate_rwlock_destroy)(const void* const rwlock)
-{
-   int res;
-   VALGRIND_DO_CLIENT_REQUEST(res, 0,
-                              VG_USERREQ__DRD_ANNOTATE_RWLOCK_DESTROY,
-                              rwlock, 0, 0, 0, 0);
-}
-
-static
-#ifdef _MSC_VER
-__inline
-#else
-__inline__
-#endif
-void DRDCL_(annotate_rwlock_acquired)(const void* const rwlock, const int is_w)
-{
-   int res;
-   VALGRIND_DO_CLIENT_REQUEST(res, 0,
-                              VG_USERREQ__DRD_ANNOTATE_RWLOCK_ACQUIRED,
-                              rwlock, is_w, 0, 0, 0);
-}
-
-static
-#ifdef _MSC_VER
-__inline
-#else
-__inline__
-#endif
-void DRDCL_(annotate_rwlock_released)(const void* const rwlock, const int is_w)
-{
-   int res;
-   VALGRIND_DO_CLIENT_REQUEST(res, 0,
-                              VG_USERREQ__DRD_ANNOTATE_RWLOCK_RELEASED,
-                              rwlock, is_w, 0, 0, 0);
-}
-
-static
-#ifdef _MSC_VER
-__inline
-#else
-__inline__
-#endif
-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", barrier, count,
-                              reinitialization_allowed, 0);
-}
-
-static
-#ifdef _MSC_VER
-__inline
-#else
-__inline__
-#endif
-void DRDCL_(annotate_barrier_destroy)(const void* barrier)
-{
-   int res;
-   VALGRIND_DO_CLIENT_REQUEST(res, 0,
-                              VG_USERREQ__DRD_ANNOTATION_UNIMP,
-                              "ANNOTATE_BARRIER_DESTROY", barrier, 0, 0, 0);
-}
-
-static
-#ifdef _MSC_VER
-__inline
-#else
-__inline__
-#endif
-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", barrier, 0, 0, 0);
-}
-
-static
-#ifdef _MSC_VER
-__inline
-#else
-__inline__
-#endif
-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", barrier, 0, 0, 0);
-}
-
-
 /**
  * @addtogroup RaceDetectionAnnotations
  */
index 18e39e2bb986b47ac1b7590242ca0f46b8ad67af..1ae8934c34b08ea1c332202c47e8bc0a6a4b42eb 100644 (file)
@@ -1,25 +1,25 @@
 
 The annotation macro ANNOTATE_BARRIER_INIT has not yet been implemented in <valgrind/drd.h>
-   at 0x........: vgDrdCl_annotate_barrier_init (drd.h:?)
-   by 0x........: barrier_init (annotate_barrier.c:?)
+   at 0x........: barrier_init (annotate_barrier.c:?)
    by 0x........: barriers_and_races (annotate_barrier.c:?)
+   by 0x........: main (annotate_barrier.c:?)
 
 Thread 2:
 The annotation macro ANNOTATE_BARRIER_WAIT_BEFORE has not yet been implemented in <valgrind/drd.h>
-   at 0x........: vgDrdCl_annotate_barrier_wait_before (drd.h:?)
-   by 0x........: barrier_wait (annotate_barrier.c:?)
+   at 0x........: barrier_wait (annotate_barrier.c:?)
    by 0x........: threadfunc (annotate_barrier.c:?)
+   by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
 
 Thread 3:
 The annotation macro ANNOTATE_BARRIER_WAIT_AFTER has not yet been implemented in <valgrind/drd.h>
-   at 0x........: vgDrdCl_annotate_barrier_wait_after (drd.h:?)
-   by 0x........: barrier_wait (annotate_barrier.c:?)
+   at 0x........: barrier_wait (annotate_barrier.c:?)
    by 0x........: threadfunc (annotate_barrier.c:?)
+   by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
 
 The annotation macro ANNOTATE_BARRIER_WAIT_BEFORE has not yet been implemented in <valgrind/drd.h>
-   at 0x........: vgDrdCl_annotate_barrier_wait_before (drd.h:?)
-   by 0x........: barrier_wait (annotate_barrier.c:?)
+   at 0x........: barrier_wait (annotate_barrier.c:?)
    by 0x........: threadfunc (annotate_barrier.c:?)
+   by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
 
 Thread 2:
 Conflicting store by thread 2 at 0x........ size 4
@@ -32,15 +32,15 @@ Address 0x........ is at offset 0 from 0x......... Allocation context:
    by 0x........: main (annotate_barrier.c:?)
 
 The annotation macro ANNOTATE_BARRIER_WAIT_AFTER has not yet been implemented in <valgrind/drd.h>
-   at 0x........: vgDrdCl_annotate_barrier_wait_after (drd.h:?)
-   by 0x........: barrier_wait (annotate_barrier.c:?)
+   at 0x........: barrier_wait (annotate_barrier.c:?)
    by 0x........: threadfunc (annotate_barrier.c:?)
+   by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
 
 Thread 1:
 The annotation macro ANNOTATE_BARRIER_DESTROY has not yet been implemented in <valgrind/drd.h>
-   at 0x........: vgDrdCl_annotate_barrier_destroy (drd.h:?)
-   by 0x........: barrier_destroy (annotate_barrier.c:?)
+   at 0x........: barrier_destroy (annotate_barrier.c:?)
    by 0x........: barriers_and_races (annotate_barrier.c:?)
+   by 0x........: main (annotate_barrier.c:?)
 
 Done.
 
index 946dbd373ead7fac95ef17e29f35317ec4c460b2..3ed15b9a73cd3c19f1ee91f938f30c5a2d128f87 100644 (file)
@@ -17,30 +17,30 @@ int main(int argc, char** argv)
   pthread_cond_init(&cv, NULL);
 
   /* happens-after without preceding happens-before. */
-  ANNOTATE_HAPPENS_AFTER(&i);
+  U_ANNOTATE_HAPPENS_AFTER(&i);
 
   /* happens-after on a mutex. */
-  ANNOTATE_HAPPENS_BEFORE(&m);
+  U_ANNOTATE_HAPPENS_BEFORE(&m);
 
   /* happens-after on a condition variable. */
-  ANNOTATE_HAPPENS_BEFORE(&cv);
+  U_ANNOTATE_HAPPENS_BEFORE(&cv);
 
   /* condition variable operation on a h.b. annotated object. */
-  ANNOTATE_HAPPENS_BEFORE(&i);
+  U_ANNOTATE_HAPPENS_BEFORE(&i);
   pthread_cond_init((pthread_cond_t*)&i, NULL);
 
   /* The sequence below is fine. */
-  ANNOTATE_NEW_MEMORY(&i, sizeof(i));
-  ANNOTATE_HAPPENS_BEFORE(&i);
-  ANNOTATE_HAPPENS_AFTER(&i);
-  ANNOTATE_NEW_MEMORY(&i, sizeof(i));
-  ANNOTATE_HAPPENS_BEFORE(&i);
-  ANNOTATE_NEW_MEMORY(&i, sizeof(i));
+  U_ANNOTATE_NEW_MEMORY(&i, sizeof(i));
+  U_ANNOTATE_HAPPENS_BEFORE(&i);
+  U_ANNOTATE_HAPPENS_AFTER(&i);
+  U_ANNOTATE_NEW_MEMORY(&i, sizeof(i));
+  U_ANNOTATE_HAPPENS_BEFORE(&i);
+  U_ANNOTATE_NEW_MEMORY(&i, sizeof(i));
 
   /* happens-before after happens-after. */
-  ANNOTATE_HAPPENS_BEFORE(&i);
-  ANNOTATE_HAPPENS_AFTER(&i);
-  ANNOTATE_HAPPENS_BEFORE(&i);
+  U_ANNOTATE_HAPPENS_BEFORE(&i);
+  U_ANNOTATE_HAPPENS_AFTER(&i);
+  U_ANNOTATE_HAPPENS_BEFORE(&i);
 
   fprintf(stderr, "Done.\n");
   return 0;
index 10c0f6c544552001c117f7a6024b74887816231b..50f51e070ac05c62febca17548a609efdbe28b20 100644 (file)
@@ -1,14 +1,12 @@
 
 wrong type of synchronization object
-   at 0x........: vgDrdCl_annotate_happens_before (drd.h:?)
-   by 0x........: main (annotate_hb_err.c:?)
+   at 0x........: main (annotate_hb_err.c:?)
 mutex 0x........ was first observed at:
    at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
    by 0x........: main (annotate_hb_err.c:?)
 
 wrong type of synchronization object
-   at 0x........: vgDrdCl_annotate_happens_before (drd.h:?)
-   by 0x........: main (annotate_hb_err.c:?)
+   at 0x........: main (annotate_hb_err.c:?)
 cond 0x........ was first observed at:
    at 0x........: pthread_cond_init (drd_pthread_intercepts.c:?)
    by 0x........: main (annotate_hb_err.c:?)
@@ -17,8 +15,7 @@ wrong type of synchronization object
    at 0x........: pthread_cond_init (drd_pthread_intercepts.c:?)
    by 0x........: main (annotate_hb_err.c:?)
 order annotation 0x........ was first observed at:
-   at 0x........: vgDrdCl_annotate_happens_after (drd.h:?)
-   by 0x........: main (annotate_hb_err.c:?)
+   at 0x........: main (annotate_hb_err.c:?)
 
 Done.
 
index 76c3a9483131c85d217e20afe83618a9e728b118..0c2b450f9f339d10b2325cb0558fd655fe66df00 100644 (file)
@@ -18,9 +18,9 @@ static void* thread_func(void* arg)
 {
   int i;
 
-  ANNOTATE_HAPPENS_AFTER(&s_i);
+  U_ANNOTATE_HAPPENS_AFTER(&s_i);
   i = s_i;
-  ANNOTATE_HAPPENS_AFTER(&s_i);
+  U_ANNOTATE_HAPPENS_AFTER(&s_i);
   *(int*)arg = i;
   return NULL;
 }
@@ -30,7 +30,7 @@ int main(int argc, char** argv)
   pthread_t tid[2];
   int result[2];
 
-  ANNOTATE_HAPPENS_BEFORE(&s_i);
+  U_ANNOTATE_HAPPENS_BEFORE(&s_i);
   pthread_create(&tid[0], 0, thread_func, &result[0]);
   pthread_create(&tid[1], 0, thread_func, &result[1]);
   s_i = 1;
index c1ee6dbed75b27ecf6c528b562b13e42b5154288..b3d2dc9f1bb345dc6f56ae0a57f4452abc44923e 100644 (file)
@@ -3,12 +3,10 @@ Attempt to use a user-defined rwlock as a POSIX rwlock: rwlock 0x.........
    at 0x........: pthread_rwlock_init (drd_pthread_intercepts.c:?)
    by 0x........: main (rwlock_type_checking.c:?)
 rwlock 0x........ was first observed at:
-   at 0x........: vgDrdCl_annotate_rwlock_create (drd.h:?)
-   by 0x........: main (rwlock_type_checking.c:?)
+   at 0x........: main (rwlock_type_checking.c:?)
 
 Attempt to use a POSIX rwlock as a user-defined rwlock: rwlock 0x.........
-   at 0x........: vgDrdCl_annotate_rwlock_released (drd.h:?)
-   by 0x........: main (rwlock_type_checking.c:?)
+   at 0x........: main (rwlock_type_checking.c:?)
 rwlock 0x........ was first observed at:
    at 0x........: pthread_rwlock_init (drd_pthread_intercepts.c:?)
    by 0x........: main (rwlock_type_checking.c:?)
index 05461c56f57e725820d0dfcaa8993f32a6479d7d..cfb9b3cd277c43971c22dd7dd7b732866d1135e7 100644 (file)
@@ -65,7 +65,8 @@ using namespace std;
 
 #include "../../drd/drd.h"
 #define ANNOTATE_NO_OP(arg) do { } while(0)
-#define ANNOTATE_EXPECT_RACE(addr, descr) DRDCL_(ignore_range)(addr, 4)
+#define ANNOTATE_EXPECT_RACE(addr, descr)                \
+    ANNOTATE_BENIGN_RACE_SIZED(addr, 4, "expected race")
 static inline bool RunningOnValgrind() { return RUNNING_ON_VALGRIND; }
 
 #include <assert.h>
index 8bf66888b8e0c121b583ab5551685455dc6aa0aa..c5151cd778510d9c6bbb0fbb52f0a3c20ccf3842 100644 (file)
@@ -6,26 +6,24 @@
 
 
 /*
- * Redefine the happens before/after/done annotation macros such that these
- * can be intercepted by DRD, Helgrind and ThreadSanitizer. See also
+ * Define annotation macros such that these can be intercepted by DRD, Helgrind
+ * and ThreadSanitizer. See also
  * http://code.google.com/p/data-race-test/source/browse/trunk/dynamic_annotations/dynamic_annotations.h
  */
-#undef ANNOTATE_HAPPENS_BEFORE
-#define ANNOTATE_HAPPENS_BEFORE(addr)                  \
+#define U_ANNOTATE_NEW_MEMORY(addr, size) ANNOTATE_NEW_MEMORY(addr, size)
+#define U_ANNOTATE_HAPPENS_BEFORE(addr)                        \
   do {                                                 \
-    DRDCL_(annotate_happens_before)(addr);             \
+    ANNOTATE_HAPPENS_BEFORE(addr);                     \
     AnnotateCondVarSignal(__FILE__, __LINE__, addr);   \
   } while(0)
-#undef ANNOTATE_HAPPENS_AFTER
-#define ANNOTATE_HAPPENS_AFTER(addr)                           \
+#define U_ANNOTATE_HAPPENS_AFTER(addr)                         \
   do {                                                         \
-    DRDCL_(annotate_happens_after)(addr);                      \
+    ANNOTATE_HAPPENS_AFTER(addr);                              \
     AnnotateCondVarWait(__FILE__, __LINE__, addr, NULL);       \
   } while(0)
-#undef ANNOTATE_HAPPENS_DONE
-#define ANNOTATE_HAPPENS_DONE(addr)            \
+#define U_ANNOTATE_HAPPENS_DONE(addr)          \
   do {                                         \
-    DRDCL_(annotate_happens_done)(addr);       \
+    ANNOTATE_HAPPENS_DONE(addr);               \
   } while(0)