- Added support for most of the ANNOTATE_...() macro's supported by             
  ThreadSanitizer.                                                              
- Modified DRD's error reporting code such that it does no longer let           
  the Valgrind core print the Valgrind thread ID but that it now prints         
  the DRD thread ID and name. Updated expected output files where               
  necessary.                                                                    
- Modified drd/test/Makefile.am such that the tests using gcc's built-in        
  functions for atomic memory access such that these are only compiled when     
  the gcc version in use supports these built-in functions.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10186 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/drd/drd_error.h b/drd/drd_error.h
index 2d5e643..c9d89fd 100644
--- a/drd/drd_error.h
+++ b/drd/drd_error.h
@@ -87,9 +87,12 @@
    DebugInfo*  debuginfo;     //   Segment
    Char        name[256];     //   Segment
    Char        descr[256];    //   Segment
-}
-   AddrInfo;
+} AddrInfo;
 
+/*
+ * NOTE: the first member of each error info structure MUST be the thread ID
+ * in which the error has been observed.
+ */
 typedef struct {
    DrdThreadId   tid;         // Thread ID of the running thread.
    Addr          addr;        // Conflicting address in current thread.
@@ -98,47 +101,56 @@
 } DataRaceErrInfo;
 
 typedef struct {
-   Addr mutex;
-   Int recursion_count;
+   DrdThreadId tid;
+   Addr        mutex;
+   Int         recursion_count;
    DrdThreadId owner;
 } MutexErrInfo;
 
 typedef struct {
-   Addr cond;
+   DrdThreadId tid;
+   Addr        cond;
 } CondErrInfo;
 
 typedef struct {
+   DrdThreadId tid;
    Addr        cond;
    Addr        mutex;
-   DrdThreadId tid;
+   DrdThreadId owner;
 } CondDestrErrInfo;
 
 typedef struct {
-   Addr cond;
-   Addr mutex;
+   DrdThreadId tid;
+   Addr        cond;
+   Addr        mutex;
 } CondRaceErrInfo;
 
 typedef struct {
-   Addr cond;
-   Addr mutex1;
-   Addr mutex2;
+   DrdThreadId tid;
+   Addr        cond;
+   Addr        mutex1;
+   Addr        mutex2;
 } CondWaitErrInfo;
 
 typedef struct {
-   Addr semaphore;
+   DrdThreadId tid;
+   Addr        semaphore;
 } SemaphoreErrInfo;
 
 typedef struct {
+   DrdThreadId tid;
    Addr        barrier;
    DrdThreadId other_tid;
    ExeContext* other_context;
 } BarrierErrInfo;
 
 typedef struct {
-   Addr rwlock;
+   DrdThreadId tid;
+   Addr        rwlock;
 } RwlockErrInfo;
 
 typedef struct {
+   DrdThreadId tid;
    Addr        synchronization_object;
    ExeContext* acquired_at;
    UInt        hold_time_ms;
@@ -146,6 +158,7 @@
 } HoldtimeErrInfo;
 
 typedef struct {
+   DrdThreadId tid;
 } GenericErrInfo;