Author: sewardj
Date: 2008-02-22 01:19:49 +0000 (Fri, 22 Feb 2008)
New Revision: 7434

Log:
Connect Helgrind up to the new address-describing machinery.


Modified:
   branches/DATASYMS/coregrind/m_debuginfo/debuginfo.c
   branches/DATASYMS/helgrind/hg_main.c


Modified: branches/DATASYMS/coregrind/m_debuginfo/debuginfo.c
===================================================================
--- branches/DATASYMS/coregrind/m_debuginfo/debuginfo.c 2008-02-21 20:32:57 UTC 
(rev 7433)
+++ branches/DATASYMS/coregrind/m_debuginfo/debuginfo.c 2008-02-22 01:19:49 UTC 
(rev 7434)
@@ -1678,12 +1678,12 @@
 
    if ( frameNo >= 0 && (!have_srcloc) && (!have_descr) ) {
       /* no srcloc, no description:
-         Address 0x7fefff6cf is 543 bytes inside local var "a",
+         Location 0x7fefff6cf is 543 bytes inside local var "a",
          in frame #1 of thread 1
       */
       VG_(snprintf)(
          dname1, n_dname,
-         "Address 0x%lx is %lu byte%s inside local var \"%s\",",
+         "Location 0x%lx is %lu byte%s inside local var \"%s\",",
          data_addr, var_offset, vo_plural, var->name );
       VG_(snprintf)(
          dname2, n_dname,
@@ -1692,12 +1692,12 @@
    else
    if ( frameNo >= 0 && have_srcloc && (!have_descr) ) {
       /* no description:
-         Address 0x7fefff6cf is 543 bytes inside local var "a"
+         Location 0x7fefff6cf is 543 bytes inside local var "a"
          declared at dsyms7.c:17, in frame #1 of thread 1
       */
       VG_(snprintf)(
          dname1, n_dname,
-         "Address 0x%lx is %lu byte%s inside local var \"%s\"",
+         "Location 0x%lx is %lu byte%s inside local var \"%s\"",
          data_addr, var_offset, vo_plural, var->name );
       VG_(snprintf)(
          dname2, n_dname,
@@ -1707,12 +1707,12 @@
    else
    if ( frameNo >= 0 && (!have_srcloc) && have_descr ) {
       /* no srcloc:
-         Address 0x7fefff6cf is 2 bytes inside a[3].xyzzy[21].c2
+         Location 0x7fefff6cf is 2 bytes inside a[3].xyzzy[21].c2
          in frame #1 of thread 1
       */
       VG_(snprintf)(
          dname1, n_dname,
-         "Address 0x%lx is %lu byte%s inside %s%s",
+         "Location 0x%lx is %lu byte%s inside %s%s",
          data_addr, residual_offset, ro_plural, var->name,
          VG_(indexXA)(described,0) );
       VG_(snprintf)(
@@ -1721,11 +1721,11 @@
    } 
    else
    if ( frameNo >= 0 && have_srcloc && have_descr ) {
-     /* Address 0x7fefff6cf is 2 bytes inside a[3].xyzzy[21].c2,
+     /* Location 0x7fefff6cf is 2 bytes inside a[3].xyzzy[21].c2,
         declared at dsyms7.c:17, in frame #1 of thread 1 */
       VG_(snprintf)(
          dname1, n_dname,
-         "Address 0x%lx is %lu byte%s inside %s%s,",
+         "Location 0x%lx is %lu byte%s inside %s%s,",
          data_addr, residual_offset, ro_plural, var->name,
          VG_(indexXA)(described,0) );
       VG_(snprintf)(
@@ -1737,22 +1737,22 @@
    /* ------ global cases ------ */
    if ( frameNo >= -1 && (!have_srcloc) && (!have_descr) ) {
       /* no srcloc, no description:
-         Address 0x7fefff6cf is 543 bytes inside global var "a"
+         Location 0x7fefff6cf is 543 bytes inside global var "a"
       */
       VG_(snprintf)(
          dname1, n_dname,
-         "Address 0x%lx is %lu byte%s inside global var \"%s\"",
+         "Location 0x%lx is %lu byte%s inside global var \"%s\"",
          data_addr, var_offset, vo_plural, var->name );
    } 
    else
    if ( frameNo >= -1 && have_srcloc && (!have_descr) ) {
       /* no description:
-         Address 0x7fefff6cf is 543 bytes inside global var "a"
+         Location 0x7fefff6cf is 543 bytes inside global var "a"
          declared at dsyms7.c:17
       */
       VG_(snprintf)(
          dname1, n_dname,
-         "Address 0x%lx is %lu byte%s inside global var \"%s\"",
+         "Location 0x%lx is %lu byte%s inside global var \"%s\"",
          data_addr, var_offset, vo_plural, var->name );
       VG_(snprintf)(
          dname2, n_dname,
@@ -1762,12 +1762,12 @@
    else
    if ( frameNo >= -1 && (!have_srcloc) && have_descr ) {
       /* no srcloc:
-         Address 0x7fefff6cf is 2 bytes inside a[3].xyzzy[21].c2,
+         Location 0x7fefff6cf is 2 bytes inside a[3].xyzzy[21].c2,
          a global variable
       */
       VG_(snprintf)(
          dname1, n_dname,
-         "Address 0x%lx is %lu byte%s inside %s%s,",
+         "Location 0x%lx is %lu byte%s inside %s%s,",
          data_addr, residual_offset, ro_plural, var->name,
          VG_(indexXA)(described,0) );
       VG_(snprintf)(
@@ -1776,11 +1776,11 @@
    } 
    else
    if ( frameNo >= -1 && have_srcloc && have_descr ) {
-     /* Address 0x7fefff6cf is 2 bytes inside a[3].xyzzy[21].c2,
+     /* Location 0x7fefff6cf is 2 bytes inside a[3].xyzzy[21].c2,
         a global variable declared at dsyms7.c:17 */
       VG_(snprintf)(
          dname1, n_dname,
-         "Address 0x%lx is %lu byte%s inside %s%s,",
+         "Location 0x%lx is %lu byte%s inside %s%s,",
          data_addr, residual_offset, ro_plural, var->name,
          VG_(indexXA)(described,0) );
       VG_(snprintf)(

Modified: branches/DATASYMS/helgrind/hg_main.c
===================================================================
--- branches/DATASYMS/helgrind/hg_main.c        2008-02-21 20:32:57 UTC (rev 
7433)
+++ branches/DATASYMS/helgrind/hg_main.c        2008-02-22 01:19:49 UTC (rev 
7434)
@@ -48,6 +48,7 @@
 #include "pub_tool_options.h"
 #include "pub_tool_xarray.h"
 #include "pub_tool_stacktrace.h"
+#include "pub_tool_debuginfo.h"  /* VG_(get_data_description) */
 
 #include "helgrind.h"
 
@@ -7823,6 +7824,8 @@
             SVal  old_state;
             ExeContext* mb_lastlock;
             Thread* thr;
+            Char  descr1[96];
+            Char  descr2[96];
          } Race;
          struct {
             Thread* thr;  /* doing the freeing */
@@ -7912,6 +7915,20 @@
    // FIXME: tid vs thr
    tl_assert(isWrite == False || isWrite == True);
    tl_assert(szB == 8 || szB == 4 || szB == 2 || szB == 1);
+
+   tl_assert(sizeof(xe.XE.Race.descr1) == sizeof(xe.XE.Race.descr2));
+   xe.XE.Race.descr1[0] = xe.XE.Race.descr2[0] = 0;
+   if (VG_(get_data_description)(
+             &xe.XE.Race.descr1[0],
+             &xe.XE.Race.descr2[0],
+             sizeof(xe.XE.Race.descr1)-1,
+             data_addr )) {
+      tl_assert( xe.XE.Race.descr1
+                    [ sizeof(xe.XE.Race.descr1)-1 ] == 0);
+      tl_assert( xe.XE.Race.descr2
+                    [ sizeof(xe.XE.Race.descr2)-1 ] == 0);
+   }
+
    VG_(maybe_record_error)( map_threads_reverse_lookup_SLOW(thr),
                             XE_Race, data_addr, NULL, &xe );
 }
@@ -8447,6 +8464,12 @@
                       old_state, old_buf, new_state, new_buf);
       }
 
+      /* If we have a better description of the address, show it. */
+      if (xe->XE.Race.descr1[0] != 0)
+         VG_(message)(Vg_UserMsg, "  %s", &xe->XE.Race.descr1);
+      if (xe->XE.Race.descr2[0] != 0)
+         VG_(message)(Vg_UserMsg, "  %s", &xe->XE.Race.descr2);
+
       break; /* case XE_Race */
    } /* case XE_Race */
 


-------------------------------------------------------------------------
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