]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Describe the lock address in a lock announcement message.
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Thu, 24 Jul 2014 21:00:24 +0000 (21:00 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Thu, 24 Jul 2014 21:00:24 +0000 (21:00 +0000)
(note that some error messages are not announcing the lock,
which is not that nice).
At least the lock order violation message do not announce locks.
That should be improved/fixed

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14188

NEWS
helgrind/hg_addrdescr.h
helgrind/hg_errors.c
helgrind/tests/annotate_rwlock.stderr.exp
helgrind/tests/locked_vs_unlocked1_fwd.stderr.exp
helgrind/tests/locked_vs_unlocked1_rev.stderr.exp
helgrind/tests/locked_vs_unlocked2.stderr.exp
helgrind/tests/locked_vs_unlocked3.stderr.exp

diff --git a/NEWS b/NEWS
index b338fd77cdc66e3a53f54c5ddb41614fd3cffeb6..079f72219383651bbbadd3e6a159c055d6018ce5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -18,16 +18,18 @@ Release 3.10.0 (?? ?????? 201?)
     the block size - 8. This is e.g. used by sqlite3MemMalloc.
 
 * Helgrind:
-  - Helgrind GDB server monitor command 'info locks' giving
-    the list of locks, their location, and their status.
   - Race condition error message with allocated blocks also show
     the thread nr that allocated the racy block.
+  - The message indicating where a lock was first observed now also
+    describes the address/location of the lock.
   - Helgrind now understands the Ada task termination rules
     and creates a 'H-B relationship' between a terminated task and
     its master. This avoids some false positive and avoids big
     memory usage when a lot of Ada tasks are created and terminated.
     The interceptions are only activated with gnatpro >= 7.3.0w-20140611
     or gcc >= ????? (TBD: check when changes pushed to FSF gcc).
+  - Helgrind GDB server monitor command 'info locks' giving
+    the list of locks, their location, and their status.
 
 * Callgrind:
   - callgrind_control now supports the --vgdb-prefix argument,
index 67b2bb5b32422819379f4bfd5f2e23cd6080b7ad..32d7842b9cc0cddd05f9d45d84f119bd1dc032e2 100644 (file)
    VG_(clear_addrinfo). */
 extern void HG_(describe_addr) ( Addr a, /*OUT*/AddrInfo* ai );
 
-/* Prints (using *print) the readable description of addr given in ai.
-   "what" identifies the type pointed to by addr (e.g. a lock). */
-extern void HG_(pp_addrdescr) (Bool xml, const HChar* what, Addr addr,
-                               AddrInfo* ai,
-                               void(*print)(const HChar *format, ...));
-
 /* Get a readable description of addr, then print it using HG_(pp_addrdescr)
    using xml False and VG_(printf) to emit the characters.
    Returns True if a description was found/printed, False otherwise. */
index c017a9136aaaa6c6eb4dfeb025a3eb4f421a71fc..9a67b77e3bb231cdb1eecbc27c6aca030c42182a 100644 (file)
@@ -770,9 +770,15 @@ static void announce_LockP ( Lock* lk )
    if (VG_(clo_xml)) {
       /* fixme: add announcement */
    } else {
-      VG_(umsg)( "Lock at %p was first observed\n",
-                 (void*)lk->guestaddr );
-      VG_(pp_ExeContext)( lk->appeared_at );
+      if (lk->appeared_at) {
+         VG_(umsg)( "Lock at %p was first observed\n",
+                    (void*)lk->guestaddr );
+         VG_(pp_ExeContext)( lk->appeared_at );
+      } else {
+         VG_(umsg)( "Lock at %p : no stacktrace for first observation\n",
+                    (void*)lk->guestaddr );
+      }
+      HG_(get_and_pp_addrdescr) (lk->guestaddr);
       VG_(umsg)("\n");
    }
 }
index d62d8e4a4729d5fccba05aa458fe7b63a2180a21..9392d3939704f86a4e26feb7f0469265ca1635f7 100644 (file)
@@ -102,6 +102,7 @@ Locks held: none
 Lock at 0x........ was first observed
    at 0x........: rwlock_init (annotate_rwlock.c:54)
    by 0x........: main (annotate_rwlock.c:161)
+ Address 0x........ is 0 bytes inside data symbol "s_rwlock"
 
 Possible data race during write of size 4 at 0x........ by thread #x
 Locks held: 1, at address 0x........
index 5834cbd76e38820d8524736f55115d0a4e9a5c2a..43193988ea2e20653786a678d3ba839c0b90f5c0 100644 (file)
@@ -19,6 +19,7 @@ Lock at 0x........ was first observed
    by 0x........: child_fn (locked_vs_unlocked1.c:18)
    by 0x........: mythread_wrapper (hg_intercepts.c:...)
    ...
+ Address 0x........ is 0 bytes inside data symbol "mx"
 
 Possible data race during write of size 4 at 0x........ by thread #x
 Locks held: none
index 05e2175839aa2b46d0cced1ebf6dd49ebd62289b..bcf728cfaa5cd5b8735942084fe10f32cf5d75f4 100644 (file)
@@ -19,6 +19,7 @@ Lock at 0x........ was first observed
    by 0x........: child_fn (locked_vs_unlocked1.c:18)
    by 0x........: mythread_wrapper (hg_intercepts.c:...)
    ...
+ Address 0x........ is 0 bytes inside data symbol "mx"
 
 Possible data race during write of size 4 at 0x........ by thread #x
 Locks held: 1, at address 0x........
index 6e0e068748f6f9272fb09db4235cf865132280d3..b4051fd93f41a1c80dd135c316017b3fa839423a 100644 (file)
@@ -17,14 +17,17 @@ Thread #x was created
 Lock at 0x........ was first observed
    at 0x........: pthread_mutex_init (hg_intercepts.c:...)
    by 0x........: main (locked_vs_unlocked2.c:58)
+ Address 0x........ is 0 bytes inside data symbol "mx2a"
 
 Lock at 0x........ was first observed
    at 0x........: pthread_mutex_init (hg_intercepts.c:...)
    by 0x........: main (locked_vs_unlocked2.c:59)
+ Address 0x........ is 0 bytes inside data symbol "mx2b"
 
 Lock at 0x........ was first observed
    at 0x........: pthread_mutex_init (hg_intercepts.c:...)
    by 0x........: main (locked_vs_unlocked2.c:57)
+ Address 0x........ is 0 bytes inside data symbol "mx1b"
 
 Possible data race during write of size 4 at 0x........ by thread #x
 Locks held: 2, at addresses 0x........ 0x........
index e5f4b5d7a6db16b5a67f1d92ae98715cb6ac73e2..6e62ca73d175d36a8f56055a17f61cd9ac9bc88d 100644 (file)
@@ -17,6 +17,7 @@ Thread #x was created
 Lock at 0x........ was first observed
    at 0x........: pthread_mutex_init (hg_intercepts.c:...)
    by 0x........: main (locked_vs_unlocked3.c:51)
+ Address 0x........ is 0 bytes inside data symbol "mx"
 
 Possible data race during write of size 4 at 0x........ by thread #x
 Locks held: none