]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Cleaned up generation of "Not a mutex" error messages.
authorBart Van Assche <bvanassche@acm.org>
Tue, 26 Feb 2008 19:13:04 +0000 (19:13 +0000)
committerBart Van Assche <bvanassche@acm.org>
Tue, 26 Feb 2008 19:13:04 +0000 (19:13 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7483

exp-drd/drd_error.c
exp-drd/drd_error.h
exp-drd/drd_mutex.c
exp-drd/tests/tc06_two_races.stderr.exp2 [new file with mode: 0644]
exp-drd/tests/tc07_hbl1.vgtest [deleted file]
exp-drd/tests/tc08_hbl2.vgtest [deleted file]
exp-drd/tests/tc09_bad_unlock.stderr.exp
exp-drd/tests/tc20_verifywrap.stderr.exp
exp-drd/tests/tc20_verifywrap.stderr.exp2
exp-drd/tests/tc23_bogus_condwait.stderr.exp

index e38e6c4df1ae620265ba62604d60579aa60bbef6..bc76f5a1804e5a05ba6ff2e672705fcdb9c0c66b 100644 (file)
@@ -259,12 +259,13 @@ static void drd_tool_error_pp(Error* const e)
    }
    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 @@ static void drd_tool_error_pp(Error* const e)
       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 @@ static UInt drd_tool_error_update_extra(Error* e)
       return sizeof(CondRaceErrInfo);
    case CondErr:
       return sizeof(CondErrInfo);
+   case GenericErr:
+      return sizeof(GenericErrInfo);
    default:
       tl_assert(False);
       break;
index 81e7932dd497c81618f475f5d7cea63eeb538da7..e9a54c48b3c269bf3d8362fa68960c1961bb10a1 100644 (file)
@@ -40,7 +40,8 @@ typedef enum {
    DataRaceErr    = 1,
    MutexErr       = 2,
    CondRaceErr    = 3,
-   CondErr = 4,
+   CondErr        = 4,
+   GenericErr     = 5,
 } DrdErrorKind;
 
 /* The classification of a faulting address. */
@@ -94,6 +95,9 @@ typedef struct {
    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);
index 355c66ba6bafdb8e6a83c43cbd838dcbb26a589b..4fcf34e98470aa36d4ce56323690fca696f00fbe 100644 (file)
@@ -112,12 +112,12 @@ mutex_get_or_allocate(const Addr mutex,
     {
       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 @@ int mutex_lock(const Addr mutex, const SizeT size, MutexT mutex_type)
 
   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 @@ int mutex_unlock(const Addr mutex, const MutexT mutex_type)
 
   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;
   }
 
diff --git a/exp-drd/tests/tc06_two_races.stderr.exp2 b/exp-drd/tests/tc06_two_races.stderr.exp2
new file mode 100644 (file)
index 0000000..4cbed89
--- /dev/null
@@ -0,0 +1 @@
+ERROR SUMMARY: 4 errors from 4 contexts
diff --git a/exp-drd/tests/tc07_hbl1.vgtest b/exp-drd/tests/tc07_hbl1.vgtest
deleted file mode 100644 (file)
index 71c463f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-prog: tc07_hbl1
diff --git a/exp-drd/tests/tc08_hbl2.vgtest b/exp-drd/tests/tc08_hbl2.vgtest
deleted file mode 100644 (file)
index 665fea8..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-prog: tc08_hbl2
-stderr_filter: filter_error_summary
index b3bc83ab8da3c694cef287c446da35fb4987fbce..a631ae6396dad7db2dc1acdc46a9c35119c97a9e 100644 (file)
@@ -13,7 +13,7 @@ Mutex not unlocked by owner thread / mutex 0x........ (recursion count 1, owner
    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 @@ Mutex not unlocked by owner thread / mutex 0x........ (recursion count 1, owner
    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)
index 504ce2648b998ca9952a609fa4dee1f084958950..10c23dbdfb4ff2adadc1c766e208bf6189264177 100644 (file)
@@ -20,14 +20,14 @@ Destroying locked mutex / mutex 0x........ (recursion count 1, owner 1)
    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)
 
index 2ad249863d9a4816373abaf1ead44c8a97073ee8..73b095eeefae7b9aedd8d405d8daa205671940b7 100644 (file)
@@ -20,14 +20,14 @@ Destroying locked mutex / mutex 0x........ (recursion count 1, owner 1)
    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)
 
index 40ee726aabcdecde5bd9812ed1366d432b43301a..ede5af6298d6408daaeb6871eda344f3bcce8ed9 100644 (file)
@@ -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 @@ Race condition: condition variable 0x........ has been signalled but the associa
    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 @@ Race condition: condition variable 0x........ has been signalled but the associa
    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)