Author: bart
Date: 2008-02-26 19:13:04 +0000 (Tue, 26 Feb 2008)
New Revision: 7483

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

Added:
   trunk/exp-drd/tests/tc06_two_races.stderr.exp2
Removed:
   trunk/exp-drd/tests/tc07_hbl1.vgtest
   trunk/exp-drd/tests/tc08_hbl2.vgtest
Modified:
   trunk/exp-drd/drd_error.c
   trunk/exp-drd/drd_error.h
   trunk/exp-drd/drd_mutex.c
   trunk/exp-drd/tests/tc09_bad_unlock.stderr.exp
   trunk/exp-drd/tests/tc20_verifywrap.stderr.exp
   trunk/exp-drd/tests/tc20_verifywrap.stderr.exp2
   trunk/exp-drd/tests/tc23_bogus_condwait.stderr.exp


Modified: trunk/exp-drd/drd_error.c
===================================================================
--- trunk/exp-drd/drd_error.c   2008-02-26 19:11:20 UTC (rev 7482)
+++ trunk/exp-drd/drd_error.c   2008-02-26 19:13:04 UTC (rev 7483)
@@ -259,12 +259,13 @@
    }
    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 @@
       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 @@
       return sizeof(CondRaceErrInfo);
    case CondErr:
       return sizeof(CondErrInfo);
+   case GenericErr:
+      return sizeof(GenericErrInfo);
    default:
       tl_assert(False);
       break;

Modified: trunk/exp-drd/drd_error.h
===================================================================
--- trunk/exp-drd/drd_error.h   2008-02-26 19:11:20 UTC (rev 7482)
+++ trunk/exp-drd/drd_error.h   2008-02-26 19:13:04 UTC (rev 7483)
@@ -40,7 +40,8 @@
    DataRaceErr    = 1,
    MutexErr       = 2,
    CondRaceErr    = 3,
-   CondErr = 4,
+   CondErr        = 4,
+   GenericErr     = 5,
 } DrdErrorKind;
 
 /* The classification of a faulting address. */
@@ -94,6 +95,9 @@
    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);

Modified: trunk/exp-drd/drd_mutex.c
===================================================================
--- trunk/exp-drd/drd_mutex.c   2008-02-26 19:11:20 UTC (rev 7482)
+++ trunk/exp-drd/drd_mutex.c   2008-02-26 19:13:04 UTC (rev 7483)
@@ -112,12 +112,12 @@
     {
       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 @@
 
   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 @@
 
   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;
   }
 

Added: trunk/exp-drd/tests/tc06_two_races.stderr.exp2
===================================================================
--- trunk/exp-drd/tests/tc06_two_races.stderr.exp2                              
(rev 0)
+++ trunk/exp-drd/tests/tc06_two_races.stderr.exp2      2008-02-26 19:13:04 UTC 
(rev 7483)
@@ -0,0 +1 @@
+ERROR SUMMARY: 4 errors from 4 contexts

Deleted: trunk/exp-drd/tests/tc07_hbl1.vgtest
===================================================================
--- trunk/exp-drd/tests/tc07_hbl1.vgtest        2008-02-26 19:11:20 UTC (rev 
7482)
+++ trunk/exp-drd/tests/tc07_hbl1.vgtest        2008-02-26 19:13:04 UTC (rev 
7483)
@@ -1 +0,0 @@
-prog: tc07_hbl1

Deleted: trunk/exp-drd/tests/tc08_hbl2.vgtest
===================================================================
--- trunk/exp-drd/tests/tc08_hbl2.vgtest        2008-02-26 19:11:20 UTC (rev 
7482)
+++ trunk/exp-drd/tests/tc08_hbl2.vgtest        2008-02-26 19:13:04 UTC (rev 
7483)
@@ -1,2 +0,0 @@
-prog: tc08_hbl2
-stderr_filter: filter_error_summary

Modified: trunk/exp-drd/tests/tc09_bad_unlock.stderr.exp
===================================================================
--- trunk/exp-drd/tests/tc09_bad_unlock.stderr.exp      2008-02-26 19:11:20 UTC 
(rev 7482)
+++ trunk/exp-drd/tests/tc09_bad_unlock.stderr.exp      2008-02-26 19:13:04 UTC 
(rev 7483)
@@ -13,7 +13,7 @@
    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 @@
    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)

Modified: trunk/exp-drd/tests/tc20_verifywrap.stderr.exp
===================================================================
--- trunk/exp-drd/tests/tc20_verifywrap.stderr.exp      2008-02-26 19:11:20 UTC 
(rev 7482)
+++ trunk/exp-drd/tests/tc20_verifywrap.stderr.exp      2008-02-26 19:13:04 UTC 
(rev 7483)
@@ -20,14 +20,14 @@
    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)
 

Modified: trunk/exp-drd/tests/tc20_verifywrap.stderr.exp2
===================================================================
--- trunk/exp-drd/tests/tc20_verifywrap.stderr.exp2     2008-02-26 19:11:20 UTC 
(rev 7482)
+++ trunk/exp-drd/tests/tc20_verifywrap.stderr.exp2     2008-02-26 19:13:04 UTC 
(rev 7483)
@@ -20,14 +20,14 @@
    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)
 

Modified: trunk/exp-drd/tests/tc23_bogus_condwait.stderr.exp
===================================================================
--- trunk/exp-drd/tests/tc23_bogus_condwait.stderr.exp  2008-02-26 19:11:20 UTC 
(rev 7482)
+++ trunk/exp-drd/tests/tc23_bogus_condwait.stderr.exp  2008-02-26 19:13:04 UTC 
(rev 7483)
@@ -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 @@
    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 @@
    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)
 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Valgrind-developers mailing list
Valgrind-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-developers

Reply via email to