Author: sewardj
Date: 2008-02-12 21:55:15 +0000 (Tue, 12 Feb 2008)
New Revision: 7404

Log:
Start tidying up (non-functional change):

* move stuff to do with Dwarf3 expression evaluation into
  d3basics.c, a sane place for it

* get rid of VG_(get_error_tid) introduced in r7375 as it
  is not necessary

* remove unneeded parameters from Memcheck's describe_addr function



Modified:
   branches/DATASYMS/coregrind/m_debuginfo/d3basics.c
   branches/DATASYMS/coregrind/m_debuginfo/debuginfo.c
   branches/DATASYMS/coregrind/m_debuginfo/priv_d3basics.h
   branches/DATASYMS/coregrind/m_debuginfo/priv_readdwarf3.h
   branches/DATASYMS/coregrind/m_debuginfo/readdwarf3.c
   branches/DATASYMS/coregrind/m_debuginfo/storage.c
   branches/DATASYMS/coregrind/m_debuginfo/tytypes.c
   branches/DATASYMS/coregrind/m_errormgr.c
   branches/DATASYMS/include/pub_tool_errormgr.h
   branches/DATASYMS/memcheck/mc_main.c


Modified: branches/DATASYMS/coregrind/m_debuginfo/d3basics.c
===================================================================
--- branches/DATASYMS/coregrind/m_debuginfo/d3basics.c  2008-02-12 20:18:11 UTC 
(rev 7403)
+++ branches/DATASYMS/coregrind/m_debuginfo/d3basics.c  2008-02-12 21:55:15 UTC 
(rev 7404)
@@ -35,6 +35,10 @@
 */
 
 #include "pub_core_basics.h"
+#include "pub_core_libcassert.h"
+#include "pub_core_libcprint.h"
+#include "pub_core_options.h"
+
 #include "priv_d3basics.h"      /* self */
 
 HChar* ML_(pp_DW_children) ( DW_children hashch )
@@ -307,6 +311,261 @@
 }
 
 
+/* ------ To do with evaluation of Dwarf expressions ------ */
+
+/* FIXME: duplicated in readdwarf.c */
+static 
+ULong read_leb128 ( UChar* data, Int* length_return, Int sign )
+{
+  ULong  result = 0;
+  UInt   num_read = 0;
+  Int    shift = 0;
+  UChar  byte;
+
+  vg_assert(sign == 0 || sign == 1);
+
+  do
+    {
+      byte = * data ++;
+      num_read ++;
+
+      result |= ((ULong)(byte & 0x7f)) << shift;
+
+      shift += 7;
+
+    }
+  while (byte & 0x80);
+
+  if (length_return != NULL)
+    * length_return = num_read;
+
+  if (sign && (shift < 64) && (byte & 0x40))
+    result |= -(1ULL << shift);
+
+  return result;
+}
+
+/* Small helper functions easier to use
+ * value is returned and the given pointer is
+ * moved past end of leb128 data */
+/* FIXME: duplicated in readdwarf.c */
+static ULong read_leb128U( UChar **data )
+{
+  Int len;
+  ULong val = read_leb128( *data, &len, 0 );
+  *data += len;
+  return val;
+}
+
+/* Same for signed data */
+/* FIXME: duplicated in readdwarf.c */
+static Long read_leb128S( UChar **data )
+{
+   Int len;
+   ULong val = read_leb128( *data, &len, 1 );
+   *data += len;
+   return (Long)val;
+}
+
+
+/* FIXME: duplicates logic in readdwarf.c: copy_convert_CfiExpr_tree
+   and {FP,SP}_REG decls */
+static Bool get_Dwarf_Reg( /*OUT*/Addr* a, Word regno, RegSummary* regs )
+{
+   vg_assert(regs);
+#  if defined(VGP_amd64_linux)
+   if (regno == 6/*RBP*/) { *a = regs->fp; return True; }
+   if (regno == 7/*RSP*/) { *a = regs->sp; return True; }
+#  elif defined(VGP_x86_linux)
+   if (regno == 5/*EBP*/) { *a = regs->fp; return True; }
+   if (regno == 4/*ESP*/) { *a = regs->sp; return True; }
+#  else
+#    error "Unknown platform"
+#  endif
+   return False;
+}
+
+
+/* Evaluate a standard DWARF3 expression.  See detailed description in
+   priv_d3basics.h. */
+GXResult ML_(evaluate_Dwarf3_Expr) ( UChar* expr, UWord exprszB, 
+                                     GExpr* fbGX, RegSummary* regs,
+                                     Bool push_initial_zero )
+{
+#  define N_EXPR_STACK 20
+
+#  define FAIL(_str)                                          \
+      do {                                                    \
+         GXResult res;                                        \
+         res.res = 0;                                         \
+         res.failure = (_str);                                \
+         return res;                                          \
+      } while (0)
+
+#  define PUSH(_arg)                                          \
+      do {                                                    \
+         vg_assert(sp >= -1 && sp < N_EXPR_STACK);            \
+         if (sp == N_EXPR_STACK-1)                            \
+            FAIL("evaluate_Dwarf3_Expr: stack overflow(1)");  \
+         sp++;                                                \
+         stack[sp] = (_arg);                                  \
+      } while (0)
+
+#  define POP(_lval)                                          \
+      do {                                                    \
+         vg_assert(sp >= -1 && sp < N_EXPR_STACK);            \
+         if (sp == -1)                                        \
+            FAIL("evaluate_Dwarf3_Expr: stack underflow(1)"); \
+         _lval = stack[sp];                                   \
+         sp--;                                                \
+      } while (0)
+
+   UChar    opcode;
+   UChar*   limit;
+   Int      sp; /* # of top element: valid is -1 .. N_EXPR_STACK-1 */
+   Addr     stack[N_EXPR_STACK]; /* stack of addresses, as per D3 spec */
+   GXResult fbval;
+   Addr     a1;
+   Word     sw1;
+   UWord    uw1;
+
+   sp = -1;
+   vg_assert(expr);
+   vg_assert(exprszB >= 0);
+   limit = expr + exprszB;
+
+   if (push_initial_zero)
+      PUSH(0);
+
+   while (True) {
+
+      vg_assert(sp >= -1 && sp < N_EXPR_STACK);
+
+      if (expr > limit) 
+         /* overrun - something's wrong */
+         FAIL("evaluate_Dwarf3_Expr: ran off end of expr");
+
+      if (expr == limit) {
+         /* end of expr - return expr on the top of stack. */
+         if (sp == -1)
+            /* stack empty.  Bad. */
+            FAIL("evaluate_Dwarf3_Expr: stack empty at end of expr");
+         else
+            break;
+      }
+
+      opcode = *expr++;
+      switch (opcode) {
+         case DW_OP_addr:
+            /* FIXME: surely this is an svma?  Should be t- or d-
+               biased before being pushed? */
+            PUSH( *(Addr*)expr ); 
+            expr += sizeof(Addr);
+            break;
+         case DW_OP_fbreg:
+            if (!fbGX)
+               FAIL("evaluate_Dwarf3_Expr: DW_OP_fbreg with "
+                    "no expr for fbreg present");
+            fbval = ML_(evaluate_GX)(fbGX, NULL, regs);
+            if (fbval.failure)
+               return fbval;
+            sw1 = (Word)read_leb128S( &expr );
+            PUSH( fbval.res + sw1 );
+            break;
+         case DW_OP_breg0 ... DW_OP_breg31:
+            if (!regs)
+               FAIL("evaluate_Dwarf3_Expr: DW_OP_breg* but no reg info");
+            a1 = 0;
+            if (!get_Dwarf_Reg( &a1, opcode - DW_OP_breg0, regs ))
+               FAIL("evaluate_Dwarf3_Expr: unhandled DW_OP_breg*");
+            sw1 = (Word)read_leb128S( &expr );
+            a1 += sw1;
+            PUSH( a1 );
+            break;
+         case DW_OP_plus_uconst:
+            POP(uw1);
+            uw1 += (UWord)read_leb128U( &expr );
+            PUSH(uw1);
+            break;
+         default:
+            if (!VG_(clo_xml))
+               VG_(message)(Vg_DebugMsg, 
+                            "Warning: DWARF3 CFI reader: unhandled DW_OP_ "
+                            "opcode 0x%x", (Int)opcode); 
+            FAIL("evaluate_Dwarf3_Expr: unhandled DW_OP_");
+      }
+
+   }
+
+   vg_assert(sp >= 0 && sp < N_EXPR_STACK);
+
+   { GXResult res; 
+     res.res = stack[sp];
+     res.failure = NULL;
+     return res;
+   }
+
+#  undef POP
+#  undef PUSH
+#  undef FAIL
+#  undef N_EXPR_STACK
+}
+
+
+/* Evaluate a so-called Guarded (DWARF3) expression.  See detailed
+   description in priv_d3basics.h. */
+GXResult ML_(evaluate_GX)( GExpr* gx, GExpr* fbGX, RegSummary* regs )
+{
+   GXResult res;
+   Addr     aMin, aMax;
+   UChar    uc;
+   UShort   nbytes;
+   UWord    nGuards = 0;
+   UChar* p = &gx->payload[0];
+   uc = *p++; /*biasMe*/
+   vg_assert(uc == 0 || uc == 1);
+   /* in fact it's senseless to evaluate if the guards need biasing.
+      So don't. */
+   vg_assert(uc == 0);
+   while (True) {
+      uc = *p++;
+      if (uc == 1) { /*isEnd*/
+         /* didn't find any matching range. */
+         res.res = 0;
+         res.failure = "no matching range";
+         return res;
+      }
+      vg_assert(uc == 0);
+      aMin   = * (Addr*)p;   p += sizeof(Addr);
+      aMax   = * (Addr*)p;   p += sizeof(Addr);
+      nbytes = * (UShort*)p; p += sizeof(UShort);
+      nGuards++;
+      if (regs == NULL) {
+         vg_assert(aMin == (Addr)0);
+         vg_assert(aMax == ~(Addr)0);
+         /* Assert this is the first guard. */
+         vg_assert(nGuards == 1);
+         res = ML_(evaluate_Dwarf3_Expr)(
+                  p, (UWord)nbytes, fbGX, regs,
+                  False/*push_initial_zero*/ );
+         /* Now check there are no more guards. */
+         p += (UWord)nbytes;
+         vg_assert(*p == 1); /*isEnd*/
+         return res;
+      } else {
+         if (aMin <= regs->ip && regs->ip <= aMax) {
+            /* found a matching range.  Evaluate the expression. */
+            return ML_(evaluate_Dwarf3_Expr)(
+                      p, (UWord)nbytes, fbGX, regs,
+                      False/*push_initial_zero*/ );
+         }
+      }
+      /* else keep searching */
+      p += (UWord)nbytes;
+   }
+}
+
+
 /*--------------------------------------------------------------------*/
 /*--- end                                               d3basics.c ---*/
 /*--------------------------------------------------------------------*/

Modified: branches/DATASYMS/coregrind/m_debuginfo/debuginfo.c
===================================================================
--- branches/DATASYMS/coregrind/m_debuginfo/debuginfo.c 2008-02-12 20:18:11 UTC 
(rev 7403)
+++ branches/DATASYMS/coregrind/m_debuginfo/debuginfo.c 2008-02-12 21:55:15 UTC 
(rev 7404)
@@ -50,7 +50,9 @@
 #include "pub_core_xarray.h"
 #include "pub_core_oset.h"
 #include "pub_core_stacktrace.h" // VG_(get_StackTrace)
+
 #include "priv_misc.h"           /* dinfo_zalloc/free */
+#include "priv_d3basics.h"       /* ML_(pp_GX) */
 #include "priv_tytypes.h"
 #include "priv_storage.h"
 #include "priv_readdwarf.h"

Modified: branches/DATASYMS/coregrind/m_debuginfo/priv_d3basics.h
===================================================================
--- branches/DATASYMS/coregrind/m_debuginfo/priv_d3basics.h     2008-02-12 
20:18:11 UTC (rev 7403)
+++ branches/DATASYMS/coregrind/m_debuginfo/priv_d3basics.h     2008-02-12 
21:55:15 UTC (rev 7404)
@@ -540,6 +540,93 @@
 HChar* ML_(pp_DW_FORM)     ( DW_FORM form );
 HChar* ML_(pp_DW_AT)       ( DW_AT attr );
 
+
+/* --- To do with evaluation of Dwarf expressions --- */
+
+/* Guarded Dwarf3 expressions, which can be linked together to form a
+   list.  The payload field contains a variable length array of bytes
+   which hold the guarded expressions.  The length can be inferred by
+   inspecting the payload bytes and so does not need to be stored
+   explicitly.
+
+   Guarded-Expression format is similar but not identical to the
+   DWARF3 location-list format.  The format of each returned block is:
+
+      UChar biasMe;
+      UChar isEnd;
+      followed by zero or more of
+
+      (Addr aMin;  Addr aMax;  UShort nbytes;  ..bytes..;  UChar isEnd)
+
+   '..bytes..' is an standard DWARF3 location expression which is
+   valid when aMin <= pc <= aMax (possibly after suitable biasing).
+
+   The number of bytes in '..bytes..' is nbytes.
+
+   The end of the sequence is marked by an isEnd == 1 value.  All
+   previous isEnd values must be zero.
+
+   biasMe is 1 if the aMin/aMax fields need this DebugInfo's text_bias
+   added before use, and 0 if the GX is this is not necessary (is
+   ready to go).
+
+   Hence the block can be quickly parsed and is self-describing.  Note
+   that aMax is 1 less than the corresponding value in a DWARF3
+   location list.  Zero length ranges, with aMax == aMin-1, are not
+   allowed.
+*/
+typedef
+   struct _GExpr { 
+      struct _GExpr* next;
+      UChar payload[0];
+   }
+   GExpr;
+
+/* Show a so-called guarded expression */
+void ML_(pp_GX) ( GExpr* gx );
+
+/* Evaluation of a DWARF3 expression (and hence of a GExpr) may
+   require knowing a suitably contextualising set of values for the
+   instruction, frame and stack pointer (and, in general, all
+   registers, though we punt on such generality here).  Here's a
+   struct to carry the bare essentials. */
+typedef
+   struct { Addr ip; Addr sp; Addr fp; }
+   RegSummary;
+
+/* This describes the result of evaluating a DWARF3 expression.  If
+   .failure is NULL, then evaluation succeeded and produced .res as
+   the result.  Else .failure is a zero terminated const string
+   summarising the reason for failure.  */
+typedef
+   struct { UWord res; HChar* failure; }
+   GXResult;
+
+/* Evaluate a guarded expression.  If regs is NULL, then gx is assumed
+   (and checked) to contain just a single guarded expression, which a
+   guard which covers the entire address space and so always evaluates
+   to True (iow, gx is a single unconditional expression).  If regs is
+   non-NULL then its 'ip' value is used to select which of the
+   embedded DWARF3 location expressions to use, and that is duly
+   evaluated.
+
+   If as part of the evaluation, a frame base value needs to be
+   computed, then fbGX can provide an expression for it.  If fbGX is
+   NULL but the frame base is still needed, then evaluation of gx as a
+   whole will fail. */
+GXResult ML_(evaluate_GX)( GExpr* gx, GExpr* fbGX, RegSummary* regs );
+
+/* This is a subsidiary of ML_(evaluate_GX), which just evaluates a
+   single standard DWARF3 expression.  Conventions w.r.t regs and fbGX
+   are as for ML_(evaluate_GX).  If push_initial_zero is True, then an
+   initial zero word is pushed on the evaluation stack at the start.
+   This is needed for computing structure field offsets.  Note that
+   ML_(evaluate_GX) and ML_(evaluate_Dwarf3_Expr) are mutually
+   recursive. */
+GXResult ML_(evaluate_Dwarf3_Expr) ( UChar* expr, UWord exprszB, 
+                                     GExpr* fbGX, RegSummary* regs,
+                                     Bool push_initial_zero );
+
 #endif /* ndef __PRIV_D3BASICS_H */
 
 /*--------------------------------------------------------------------*/

Modified: branches/DATASYMS/coregrind/m_debuginfo/priv_readdwarf3.h
===================================================================
--- branches/DATASYMS/coregrind/m_debuginfo/priv_readdwarf3.h   2008-02-12 
20:18:11 UTC (rev 7403)
+++ branches/DATASYMS/coregrind/m_debuginfo/priv_readdwarf3.h   2008-02-12 
21:55:15 UTC (rev 7404)
@@ -50,29 +50,6 @@
    UChar* debug_loc_img,    SizeT debug_loc_sz
 );
 
-typedef
-   struct _GExpr { 
-      struct _GExpr* next;
-      UChar payload[0];
-   }
-   GExpr;
-
-/* Show a so-called guarded expression */
-void ML_(pp_GX) ( GExpr* gx );
-
-/* Evaluate a guarded expression, using 'ip' to select which of the
-   embedded DWARF3 location expressions to use. */
-
-typedef
-   struct { Addr ip; Addr sp; Addr fp; }
-   RegSummary;
-
-typedef
-   struct { UWord res; HChar* failure; }
-   GXResult;
-
-GXResult ML_(evaluate_GX)( GExpr* gx, GExpr* fbGX, RegSummary* regs );
-
 #endif /* ndef __PRIV_READDWARF3_H */
 
 /*--------------------------------------------------------------------*/

Modified: branches/DATASYMS/coregrind/m_debuginfo/readdwarf3.c
===================================================================
--- branches/DATASYMS/coregrind/m_debuginfo/readdwarf3.c        2008-02-12 
20:18:11 UTC (rev 7403)
+++ branches/DATASYMS/coregrind/m_debuginfo/readdwarf3.c        2008-02-12 
21:55:15 UTC (rev 7404)
@@ -442,257 +442,6 @@
    }
 }
 
-/* FIXME: duplicated in readdwarf.c */
-static 
-ULong read_leb128 ( UChar* data, Int* length_return, Int sign )
-{
-  ULong  result = 0;
-  UInt   num_read = 0;
-  Int    shift = 0;
-  UChar  byte;
-
-  vg_assert(sign == 0 || sign == 1);
-
-  do
-    {
-      byte = * data ++;
-      num_read ++;
-
-      result |= ((ULong)(byte & 0x7f)) << shift;
-
-      shift += 7;
-
-    }
-  while (byte & 0x80);
-
-  if (length_return != NULL)
-    * length_return = num_read;
-
-  if (sign && (shift < 64) && (byte & 0x40))
-    result |= -(1ULL << shift);
-
-  return result;
-}
-
-/* Small helper functions easier to use
- * value is returned and the given pointer is
- * moved past end of leb128 data */
-/* FIXME: duplicated in readdwarf.c */
-static ULong read_leb128U( UChar **data )
-{
-  Int len;
-  ULong val = read_leb128( *data, &len, 0 );
-  *data += len;
-  return val;
-}
-
-/* Same for signed data */
-/* FIXME: duplicated in readdwarf.c */
-static Long read_leb128S( UChar **data )
-{
-   Int len;
-   ULong val = read_leb128( *data, &len, 1 );
-   *data += len;
-   return (Long)val;
-}
-
-/* FIXME: duplicates logic in readdwarf.c: copy_convert_CfiExpr_tree
-   and {FP,SP}_REG decls */
-static Bool get_Dwarf_Reg( /*OUT*/Addr* a, Word regno, RegSummary* regs )
-{
-   vg_assert(regs);
-#  if defined(VGP_amd64_linux)
-   if (regno == 6/*RBP*/) { *a = regs->fp; return True; }
-   if (regno == 7/*RSP*/) { *a = regs->sp; return True; }
-#  elif defined(VGP_x86_linux)
-   if (regno == 5/*EBP*/) { *a = regs->fp; return True; }
-   if (regno == 4/*ESP*/) { *a = regs->sp; return True; }
-#  else
-#    error "Unknown platform"
-#  endif
-   return False;
-}
-
-
-//static
-GXResult evaluate_Dwarf3_Expr ( UChar* expr, UWord exprszB, 
-                                GExpr* fbGX, RegSummary* regs,
-                                Bool push_initial_zero )
-{
-#  define N_EXPR_STACK 20
-
-#  define FAIL(_str)                                          \
-      do {                                                    \
-         GXResult res;                                        \
-         res.res = 0;                                         \
-         res.failure = (_str);                                \
-         return res;                                          \
-      } while (0)
-
-#  define PUSH(_arg)                                          \
-      do {                                                    \
-         vg_assert(sp >= -1 && sp < N_EXPR_STACK);            \
-         if (sp == N_EXPR_STACK-1)                            \
-            FAIL("evaluate_Dwarf3_Expr: stack overflow(1)");  \
-         sp++;                                                \
-         stack[sp] = (_arg);                                  \
-      } while (0)
-
-#  define POP(_lval)                                          \
-      do {                                                    \
-         vg_assert(sp >= -1 && sp < N_EXPR_STACK);            \
-         if (sp == -1)                                        \
-            FAIL("evaluate_Dwarf3_Expr: stack underflow(1)"); \
-         _lval = stack[sp];                                   \
-         sp--;                                                \
-      } while (0)
-
-   UChar    opcode;
-   UChar*   limit;
-   Int      sp; /* # of top element: valid is -1 .. N_EXPR_STACK-1 */
-   Addr     stack[N_EXPR_STACK]; /* stack of addresses, as per D3 spec */
-   GXResult fbval;
-   Addr     a1;
-   Word     sw1;
-   UWord    uw1;
-
-   sp = -1;
-   vg_assert(expr);
-   vg_assert(exprszB >= 0);
-   limit = expr + exprszB;
-
-   if (push_initial_zero)
-      PUSH(0);
-
-   while (True) {
-
-      vg_assert(sp >= -1 && sp < N_EXPR_STACK);
-
-      if (expr > limit) 
-         /* overrun - something's wrong */
-         FAIL("evaluate_Dwarf3_Expr: ran off end of expr");
-
-      if (expr == limit) {
-         /* end of expr - return expr on the top of stack. */
-         if (sp == -1)
-            /* stack empty.  Bad. */
-            FAIL("evaluate_Dwarf3_Expr: stack empty at end of expr");
-         else
-            break;
-      }
-
-      opcode = *expr++;
-      switch (opcode) {
-         case DW_OP_addr:
-            /* FIXME: surely this is an svma?  Should be t- or d-
-               biased before being pushed? */
-            PUSH( *(Addr*)expr ); 
-            expr += sizeof(Addr);
-            break;
-         case DW_OP_fbreg:
-            if (!fbGX)
-               FAIL("evaluate_Dwarf3_Expr: DW_OP_fbreg with "
-                    "no expr for fbreg present");
-            fbval = ML_(evaluate_GX)(fbGX, NULL, regs);
-            if (fbval.failure)
-               return fbval;
-            sw1 = (Word)read_leb128S( &expr );
-            PUSH( fbval.res + sw1 );
-            break;
-         case DW_OP_breg0 ... DW_OP_breg31:
-            if (!regs)
-               FAIL("evaluate_Dwarf3_Expr: DW_OP_breg* but no reg info");
-            a1 = 0;
-            if (!get_Dwarf_Reg( &a1, opcode - DW_OP_breg0, regs ))
-               FAIL("evaluate_Dwarf3_Expr: unhandled DW_OP_breg*");
-            sw1 = (Word)read_leb128S( &expr );
-            a1 += sw1;
-            PUSH( a1 );
-            break;
-         case DW_OP_plus_uconst:
-            POP(uw1);
-            uw1 += (UWord)read_leb128U( &expr );
-            PUSH(uw1);
-            break;
-         default:
-            if (!VG_(clo_xml))
-               VG_(message)(Vg_DebugMsg, 
-                            "Warning: DWARF3 CFI reader: unhandled DW_OP_ "
-                            "opcode 0x%x", (Int)opcode); 
-            FAIL("evaluate_Dwarf3_Expr: unhandled DW_OP_");
-      }
-
-   }
-
-   vg_assert(sp >= 0 && sp < N_EXPR_STACK);
-
-   { GXResult res; 
-     res.res = stack[sp];
-     res.failure = NULL;
-     return res;
-   }
-
-#  undef POP
-#  undef PUSH
-#  undef FAIL
-#  undef N_EXPR_STACK
-}
-
-/* Evaluate a guarded expression, using regs->ip to select which of
-   the embedded DWARF3 location expressions to use.  If regs is NULL,
-   then we assume (and check) that there is only one guard and that it
-   covers the entire address range, i.o.w. that there's only one guard
-   and it always evaluates to True, so we don't need to know
-   regs->ip. */
-GXResult ML_(evaluate_GX)( GExpr* gx, GExpr* fbGX, RegSummary* regs )
-{
-   GXResult res;
-   Addr     aMin, aMax;
-   UChar    uc;
-   UShort   nbytes;
-   UWord    nGuards = 0;
-   UChar* p = &gx->payload[0];
-   uc = *p++; /*biasMe*/
-   vg_assert(uc == 0 || uc == 1);
-   /* in fact it's senseless to evaluate if the guards need biasing.
-      So don't. */
-   vg_assert(uc == 0);
-   while (True) {
-      uc = *p++;
-      if (uc == 1) { /*isEnd*/
-         /* didn't find any matching range. */
-         res.res = 0;
-         res.failure = "no matching range";
-         return res;
-      }
-      vg_assert(uc == 0);
-      aMin   = * (Addr*)p;   p += sizeof(Addr);
-      aMax   = * (Addr*)p;   p += sizeof(Addr);
-      nbytes = * (UShort*)p; p += sizeof(UShort);
-      nGuards++;
-      if (regs == NULL) {
-         vg_assert(aMin == (Addr)0);
-         vg_assert(aMax == ~(Addr)0);
-         /* Assert this is the first guard. */
-         vg_assert(nGuards == 1);
-         res = evaluate_Dwarf3_Expr( p, (UWord)nbytes, fbGX, regs,
-                                     False/*push_initial_zero*/ );
-         /* Now check there are no more guards. */
-         p += (UWord)nbytes;
-         vg_assert(*p == 1); /*isEnd*/
-         return res;
-      } else {
-         if (aMin <= regs->ip && regs->ip <= aMax) {
-            /* found a matching range.  Evaluate the expression. */
-            return evaluate_Dwarf3_Expr( p, (UWord)nbytes, fbGX, regs,
-                                         False/*push_initial_zero*/ );
-         }
-      }
-      /* else keep searching */
-      p += (UWord)nbytes;
-   }
-}
-
 __attribute__((noinline))
 static GExpr* make_singleton_GX ( UChar* block, UWord nbytes )
 {

Modified: branches/DATASYMS/coregrind/m_debuginfo/storage.c
===================================================================
--- branches/DATASYMS/coregrind/m_debuginfo/storage.c   2008-02-12 20:18:11 UTC 
(rev 7403)
+++ branches/DATASYMS/coregrind/m_debuginfo/storage.c   2008-02-12 21:55:15 UTC 
(rev 7404)
@@ -45,15 +45,12 @@
 #include "pub_core_xarray.h"
 #include "pub_core_oset.h"
 
+#include "priv_misc.h"         /* dinfo_zalloc/free/strdup */
+#include "priv_d3basics.h"     /* ML_(pp_GX) */
 #include "priv_tytypes.h"
 #include "priv_storage.h"      /* self */
 
-//FIXME: get rid of this
-#include "priv_readdwarf3.h"  // ML_(pp_GX)
 
-#include "priv_misc.h"         /* dinfo_zalloc/free/strdup */
-
-
 /*------------------------------------------------------------*/
 /*--- Misc (printing, errors)                              ---*/
 /*------------------------------------------------------------*/

Modified: branches/DATASYMS/coregrind/m_debuginfo/tytypes.c
===================================================================
--- branches/DATASYMS/coregrind/m_debuginfo/tytypes.c   2008-02-12 20:18:11 UTC 
(rev 7403)
+++ branches/DATASYMS/coregrind/m_debuginfo/tytypes.c   2008-02-12 21:55:15 UTC 
(rev 7404)
@@ -38,15 +38,11 @@
 #include "pub_core_libcbase.h"
 #include "pub_core_libcprint.h"
 #include "pub_core_xarray.h"   /* to keep priv_tytypes.h happy */
+
 #include "priv_misc.h"         /* dinfo_zalloc/free/strdup */
+#include "priv_d3basics.h"     /* ML_(evaluate_Dwarf3_Expr) et al */
 #include "priv_tytypes.h"      /* self */
 
-///////////////// HACK - get rid of this
-#include "priv_readdwarf3.h"  // GXResult
-GXResult evaluate_Dwarf3_Expr ( UChar* expr, UWord exprszB, 
-                                GExpr* fbGX, RegSummary* regs,
-                                Bool push_initial_zero );
-/////////////////
 
 TyAdmin* ML_(new_TyAdmin) ( UWord cuOff, TyAdmin* next ) {
    TyAdmin* admin = ML_(dinfo_zalloc)( sizeof(TyAdmin) );
@@ -369,7 +365,7 @@
                field = *(TyField**)VG_(indexXA)( fields, i );
                vg_assert(field);
                vg_assert(field->loc);
-               res = evaluate_Dwarf3_Expr(
+               res = ML_(evaluate_Dwarf3_Expr)(
                        field->loc->bytes, field->loc->nbytes,
                        NULL/*fbGX*/, NULL/*RegSummary*/,
                        True/*push_initial_zero*/ );

Modified: branches/DATASYMS/coregrind/m_errormgr.c
===================================================================
--- branches/DATASYMS/coregrind/m_errormgr.c    2008-02-12 20:18:11 UTC (rev 
7403)
+++ branches/DATASYMS/coregrind/m_errormgr.c    2008-02-12 21:55:15 UTC (rev 
7404)
@@ -130,16 +130,6 @@
 };
 
 
-
-/* Note, VG_(get_error_tid) only produces a meaningful result at the
-   time that the error is handed to VG_(maybe_record_error), since the
-   same tid may be reassigned later to a new thread.  Caveat
-   Caller. */
-ThreadId VG_(get_error_tid) ( Error* err )
-{
-   return err->tid;
-}
-
 ExeContext* VG_(get_error_where) ( Error* err )
 {
    return err->where;

Modified: branches/DATASYMS/include/pub_tool_errormgr.h
===================================================================
--- branches/DATASYMS/include/pub_tool_errormgr.h       2008-02-12 20:18:11 UTC 
(rev 7403)
+++ branches/DATASYMS/include/pub_tool_errormgr.h       2008-02-12 21:55:15 UTC 
(rev 7404)
@@ -55,11 +55,7 @@
    Error;
 
 /* Useful in VG_(tdict).tool_error_matches_suppression(),
- * VG_(tdict).tool_pp_Error(), etc.  Note, VG_(get_error_tid) only
-   produces a meaningful result at the time that the error is
-   handed to VG_(maybe_record_error), since the same tid may be
-   reassigned later to a new thread.  Caveat Caller. */
-ThreadId    VG_(get_error_tid)     ( Error* err );
+ * VG_(tdict).tool_pp_Error(), etc */
 ExeContext* VG_(get_error_where)   ( Error* err );
 ErrorKind   VG_(get_error_kind)    ( Error* err );
 Addr        VG_(get_error_address) ( Error* err );

Modified: branches/DATASYMS/memcheck/mc_main.c
===================================================================
--- branches/DATASYMS/memcheck/mc_main.c        2008-02-12 20:18:11 UTC (rev 
7403)
+++ branches/DATASYMS/memcheck/mc_main.c        2008-02-12 21:55:15 UTC (rev 
7404)
@@ -3376,12 +3376,7 @@
 
 /* Describe an address as best you can, for error messages,
    putting the result in ai. */
-static void describe_addr ( Addr a, 
-                            /* FIXME: get rid of the next 3 args */
-                            Addr ip_at_error,
-                            Addr sp_at_error,
-                            Addr fp_at_error,
-                            /*OUT*/AddrInfo* ai )
+static void describe_addr ( Addr a, /*OUT*/AddrInfo* ai )
 {
    MC_Chunk*  mc;
    ThreadId   tid;
@@ -3486,11 +3481,6 @@
 {
    MC_Error* extra = VG_(get_error_extra)(err);
 
-   ThreadId tid = VG_(get_error_tid)(err);
-   Addr ip_at_error = VG_(get_IP)( tid );
-   Addr sp_at_error = VG_(get_SP)( tid );
-   Addr fp_at_error = VG_(get_FP)( tid );
-
    switch (VG_(get_error_kind)(err)) {
    // These ones don't have addresses associated with them, and so don't
    // need any updating.
@@ -3500,40 +3490,34 @@
    case Err_Overlap:
    case Err_RegParam:
    // For Err_Leaks the returned size does not matter -- they are always
-   // shown with VG_(unique_error)() so they 'extra' not copied.  But we make 
it
-   // consistent with the others.
+   // shown with VG_(unique_error)() so they 'extra' not copied.  But
+   // we make it consistent with the others.
    case Err_Leak:
       return sizeof(MC_Error);
 
    // These ones always involve a memory address.
    case Err_Addr:
       describe_addr ( VG_(get_error_address)(err),
-                      ip_at_error, sp_at_error, fp_at_error,
                       &extra->Err.Addr.ai );
       return sizeof(MC_Error);
    case Err_MemParam:
       describe_addr ( VG_(get_error_address)(err),
-                      ip_at_error, sp_at_error, fp_at_error,
                       &extra->Err.MemParam.ai );
       return sizeof(MC_Error);
    case Err_Jump:
       describe_addr ( VG_(get_error_address)(err),
-                      ip_at_error, sp_at_error, fp_at_error,
                       &extra->Err.Jump.ai );
       return sizeof(MC_Error);
    case Err_User:
       describe_addr ( VG_(get_error_address)(err),
-                      ip_at_error, sp_at_error, fp_at_error,
                       &extra->Err.User.ai );
       return sizeof(MC_Error);
    case Err_Free:
       describe_addr ( VG_(get_error_address)(err),
-                      ip_at_error, sp_at_error, fp_at_error,
                       &extra->Err.Free.ai );
       return sizeof(MC_Error);
    case Err_IllegalMempool:
       describe_addr ( VG_(get_error_address)(err),
-                      ip_at_error, sp_at_error, fp_at_error,
                       &extra->Err.IllegalMempool.ai );
       return sizeof(MC_Error);
 


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