Mark Wielaard b8b0f5
------------------------------------------------------------------------
Mark Wielaard b8b0f5
r13008 | tom | 2012-09-21 10:57:46 +0200 (Fri, 21 Sep 2012) | 3 lines
Mark Wielaard b8b0f5
Mark Wielaard b8b0f5
When processing DW_OP_plus_uconst make sure we record an add, not
Mark Wielaard b8b0f5
whatever binary operation we happened to see last.
Mark Wielaard b8b0f5
Mark Wielaard b8b0f5
------------------------------------------------------------------------
Mark Wielaard b8b0f5
r13009 | tom | 2012-09-21 11:04:27 +0200 (Fri, 21 Sep 2012) | 2 lines
Mark Wielaard b8b0f5
Mark Wielaard b8b0f5
Rename CfiOp to CfiBinop in preparation for adding unary operators.
Mark Wielaard b8b0f5
Mark Wielaard b8b0f5
------------------------------------------------------------------------
Mark Wielaard b8b0f5
r13010 | tom | 2012-09-21 11:12:30 +0200 (Fri, 21 Sep 2012) | 3 lines
Mark Wielaard b8b0f5
Mark Wielaard b8b0f5
Implement some extra DW_OPs - more constants and some unary operators.
Mark Wielaard b8b0f5
Patch from Mark Wielaard on BZ#307038.
Mark Wielaard b8b0f5
Mark Wielaard b8b0f5
------------------------------------------------------------------------
Mark Wielaard b8b0f5
Mark Wielaard b8b0f5
Index: valgrind/coregrind/m_debuginfo/readdwarf.c
Mark Wielaard b8b0f5
===================================================================
Mark Wielaard b8b0f5
--- valgrind/coregrind/m_debuginfo/readdwarf.c	(revision 13007)
Mark Wielaard c728a3
+++ valgrind/coregrind/m_debuginfo/readdwarf.c	(working copy)
Mark Wielaard b8b0f5
@@ -2728,12 +2728,13 @@
Mark Wielaard b8b0f5
          sp--;                                     \
Mark Wielaard b8b0f5
       } while (0)
Mark Wielaard b8b0f5
 
Mark Wielaard b8b0f5
-   Int    ix, ix2, reg;
Mark Wielaard b8b0f5
-   UChar  opcode;
Mark Wielaard b8b0f5
-   Word   sw;
Mark Wielaard b8b0f5
-   UWord  uw;
Mark Wielaard b8b0f5
-   CfiOp  op;
Mark Wielaard b8b0f5
-   HChar* opname;
Mark Wielaard b8b0f5
+   Int      ix, ix2, reg;
Mark Wielaard b8b0f5
+   UChar    opcode;
Mark Wielaard b8b0f5
+   Word     sw;
Mark Wielaard b8b0f5
+   UWord    uw;
Mark Wielaard b8b0f5
+   CfiUnop  uop;
Mark Wielaard b8b0f5
+   CfiBinop bop;
Mark Wielaard b8b0f5
+   HChar*   opname;
Mark Wielaard a928b7
 
Mark Wielaard a928b7
    Int sp; /* # of top element: valid is -1 .. N_EXPR_STACK-1 */
Mark Wielaard b8b0f5
    Int stack[N_EXPR_STACK];  /* indices into ctx->exprs */
Mark Wielaard b8b0f5
@@ -2752,7 +2753,7 @@
Mark Wielaard b8b0f5
       if (ctxs->cfa_is_regoff) {
Mark Wielaard b8b0f5
          /* cfa is reg +/- offset */
Mark Wielaard b8b0f5
          ix = ML_(CfiExpr_Binop)( dst,
Mark Wielaard b8b0f5
-                 Cop_Add,
Mark Wielaard b8b0f5
+                 Cbinop_Add,
Mark Wielaard b8b0f5
                  ML_(CfiExpr_DwReg)( dst, ctxs->cfa_reg ),
Mark Wielaard b8b0f5
                  ML_(CfiExpr_Const)( dst, (UWord)(Word)ctxs->cfa_off )
Mark Wielaard b8b0f5
               );
Mark Wielaard a928b7
@@ -2778,7 +2779,7 @@
Mark Wielaard a928b7
            break;
Mark Wielaard a928b7
       }
Mark Wielaard a928b7
 
Mark Wielaard a928b7
-      op = 0; opname = NULL; /* excessively conservative */
Mark Wielaard b8b0f5
+      uop = 0; bop = 0; opname = NULL; /* excessively conservative */
Mark Wielaard a928b7
 
Mark Wielaard a928b7
       opcode = *expr++;
Mark Wielaard a928b7
       switch (opcode) {
Mark Wielaard b8b0f5
@@ -2798,7 +2799,7 @@
Mark Wielaard b8b0f5
             vg_assert(reg >= 0 && reg <= 31);
Mark Wielaard b8b0f5
             sw = read_leb128S( &expr );
Mark Wielaard b8b0f5
             ix = ML_(CfiExpr_Binop)( dst,
Mark Wielaard b8b0f5
-                    Cop_Add,
Mark Wielaard b8b0f5
+                    Cbinop_Add,
Mark Wielaard b8b0f5
                     ML_(CfiExpr_DwReg)( dst, reg ),
Mark Wielaard b8b0f5
                     ML_(CfiExpr_Const)( dst, (UWord)sw )
Mark Wielaard b8b0f5
                  );
Mark Wielaard b8b0f5
@@ -2822,7 +2823,7 @@
Mark Wielaard b8b0f5
             PUSH( ML_(CfiExpr_Const)( dst, uw ) );
Mark Wielaard b8b0f5
             POP( ix );
Mark Wielaard b8b0f5
             POP( ix2 );
Mark Wielaard b8b0f5
-            PUSH( ML_(CfiExpr_Binop)( dst, op, ix2, ix ) );
Mark Wielaard b8b0f5
+            PUSH( ML_(CfiExpr_Binop)( dst, Cbinop_Add, ix2, ix ) );
Mark Wielaard b8b0f5
             if (ddump_frames)
Mark Wielaard b8b0f5
                VG_(printf)("DW_OP_plus_uconst: %lu", uw);
Mark Wielaard b8b0f5
             break;
Mark Wielaard a928b7
@@ -2836,6 +2837,15 @@
Mark Wielaard a928b7
                VG_(printf)("DW_OP_const4s: %ld", sw);
Mark Wielaard a928b7
             break;
Mark Wielaard a928b7
 
Mark Wielaard a928b7
+         case DW_OP_const2s:
Mark Wielaard a928b7
+            /* push: 16-bit signed immediate */
Mark Wielaard b8b0f5
+            sw = read_le_s_encoded_literal( expr, 2 );
Mark Wielaard a928b7
+            expr += 2;
Mark Wielaard a928b7
+            PUSH( ML_(CfiExpr_Const)( dst, (UWord)sw ) );
Mark Wielaard a928b7
+            if (ddump_frames)
Mark Wielaard a928b7
+               VG_(printf)("DW_OP_const2s: %ld", sw);
Mark Wielaard a928b7
+            break;
Mark Wielaard a928b7
+
Mark Wielaard a928b7
          case DW_OP_const1s:
Mark Wielaard a928b7
             /* push: 8-bit signed immediate */
Mark Wielaard a928b7
             sw = read_le_s_encoded_literal( expr, 1 );
Mark Wielaard b8b0f5
@@ -2845,34 +2855,74 @@
Mark Wielaard a928b7
                VG_(printf)("DW_OP_const1s: %ld", sw);
Mark Wielaard a928b7
             break;
Mark Wielaard a928b7
 
Mark Wielaard a928b7
+         case DW_OP_const1u:
Mark Wielaard a928b7
+            /* push: 8-bit unsigned immediate */
Mark Wielaard a928b7
+            uw = read_le_u_encoded_literal( expr, 1 );
Mark Wielaard a928b7
+            expr += 1;
Mark Wielaard a928b7
+            PUSH( ML_(CfiExpr_Const)( dst, uw ) );
Mark Wielaard a928b7
+            if (ddump_frames)
Mark Wielaard a928b7
+               VG_(printf)("DW_OP_const1: %lu", uw);
Mark Wielaard a928b7
+            break;
Mark Wielaard a928b7
+
Mark Wielaard a928b7
+         case DW_OP_const2u:
Mark Wielaard a928b7
+            /* push: 16-bit unsigned immediate */
Mark Wielaard a928b7
+            uw = read_le_u_encoded_literal( expr, 2 );
Mark Wielaard a928b7
+            expr += 2;
Mark Wielaard a928b7
+            PUSH( ML_(CfiExpr_Const)( dst, uw ) );
Mark Wielaard a928b7
+            if (ddump_frames)
Mark Wielaard a928b7
+               VG_(printf)("DW_OP_const2: %lu", uw);
Mark Wielaard a928b7
+            break;
Mark Wielaard a928b7
+
Mark Wielaard a928b7
+         case DW_OP_const4u:
Mark Wielaard a928b7
+            /* push: 32-bit unsigned immediate */
Mark Wielaard a928b7
+            uw = read_le_u_encoded_literal( expr, 4 );
Mark Wielaard a928b7
+            expr += 4;
Mark Wielaard a928b7
+            PUSH( ML_(CfiExpr_Const)( dst, uw ) );
Mark Wielaard a928b7
+            if (ddump_frames)
Mark Wielaard a928b7
+               VG_(printf)("DW_OP_const4: %lu", uw);
Mark Wielaard a928b7
+            break;
Mark Wielaard a928b7
+
Mark Wielaard a928b7
+         case DW_OP_abs:
Mark Wielaard a928b7
+            uop = Cunop_Abs; opname = "abs"; goto unop;
Mark Wielaard a928b7
+         case DW_OP_neg:
Mark Wielaard a928b7
+            uop = Cunop_Neg; opname = "neg"; goto unop;
Mark Wielaard a928b7
+         case DW_OP_not:
Mark Wielaard a928b7
+            uop = Cunop_Not; opname = "not"; goto unop;
Mark Wielaard a928b7
+         unop:
Mark Wielaard a928b7
+            POP( ix );
Mark Wielaard a928b7
+            PUSH( ML_(CfiExpr_Unop)( dst, uop, ix ) );
Mark Wielaard a928b7
+            if (ddump_frames)
Mark Wielaard a928b7
+               VG_(printf)("DW_OP_%s", opname);
Mark Wielaard a928b7
+            break;
Mark Wielaard a928b7
+
Mark Wielaard a928b7
          case DW_OP_minus:
Mark Wielaard b8b0f5
-            op = Cop_Sub; opname = "minus"; goto binop;
Mark Wielaard b8b0f5
+            bop = Cbinop_Sub; opname = "minus"; goto binop;
Mark Wielaard a928b7
          case DW_OP_plus:
Mark Wielaard b8b0f5
-            op = Cop_Add; opname = "plus"; goto binop;
Mark Wielaard b8b0f5
+            bop = Cbinop_Add; opname = "plus"; goto binop;
Mark Wielaard b8b0f5
          case DW_OP_and:
Mark Wielaard b8b0f5
-            op = Cop_And; opname = "and"; goto binop;
Mark Wielaard b8b0f5
+            bop = Cbinop_And; opname = "and"; goto binop;
Mark Wielaard b8b0f5
          case DW_OP_mul:
Mark Wielaard b8b0f5
-            op = Cop_Mul; opname = "mul"; goto binop;
Mark Wielaard b8b0f5
+            bop = Cbinop_Mul; opname = "mul"; goto binop;
Mark Wielaard b8b0f5
          case DW_OP_shl:
Mark Wielaard b8b0f5
-            op = Cop_Shl; opname = "shl"; goto binop;
Mark Wielaard b8b0f5
+            bop = Cbinop_Shl; opname = "shl"; goto binop;
Mark Wielaard b8b0f5
          case DW_OP_shr:
Mark Wielaard b8b0f5
-            op = Cop_Shr; opname = "shr"; goto binop;
Mark Wielaard b8b0f5
+            bop = Cbinop_Shr; opname = "shr"; goto binop;
Mark Wielaard b8b0f5
          case DW_OP_eq:
Mark Wielaard b8b0f5
-            op = Cop_Eq; opname = "eq"; goto binop;
Mark Wielaard b8b0f5
+            bop = Cbinop_Eq; opname = "eq"; goto binop;
Mark Wielaard b8b0f5
          case DW_OP_ge:
Mark Wielaard b8b0f5
-            op = Cop_Ge; opname = "ge"; goto binop;
Mark Wielaard b8b0f5
+            bop = Cbinop_Ge; opname = "ge"; goto binop;
Mark Wielaard b8b0f5
          case DW_OP_gt:
Mark Wielaard b8b0f5
-            op = Cop_Gt; opname = "gt"; goto binop;
Mark Wielaard b8b0f5
+            bop = Cbinop_Gt; opname = "gt"; goto binop;
Mark Wielaard b8b0f5
          case DW_OP_le:
Mark Wielaard b8b0f5
-            op = Cop_Le; opname = "le"; goto binop;
Mark Wielaard b8b0f5
+            bop = Cbinop_Le; opname = "le"; goto binop;
Mark Wielaard b8b0f5
          case DW_OP_lt:
Mark Wielaard b8b0f5
-            op = Cop_Lt; opname = "lt"; goto binop;
Mark Wielaard b8b0f5
+            bop = Cbinop_Lt; opname = "lt"; goto binop;
Mark Wielaard b8b0f5
          case DW_OP_ne:
Mark Wielaard b8b0f5
-            op = Cop_Ne; opname = "ne"; goto binop;
Mark Wielaard b8b0f5
+            bop = Cbinop_Ne; opname = "ne"; goto binop;
Mark Wielaard b8b0f5
          binop:
Mark Wielaard b8b0f5
             POP( ix );
Mark Wielaard b8b0f5
             POP( ix2 );
Mark Wielaard b8b0f5
-            PUSH( ML_(CfiExpr_Binop)( dst, op, ix2, ix ) );
Mark Wielaard b8b0f5
+            PUSH( ML_(CfiExpr_Binop)( dst, bop, ix2, ix ) );
Mark Wielaard b8b0f5
             if (ddump_frames)
Mark Wielaard b8b0f5
                VG_(printf)("DW_OP_%s", opname);
Mark Wielaard b8b0f5
             break;
Mark Wielaard b8b0f5
Index: coregrind/m_debuginfo/debuginfo.c
Mark Wielaard b8b0f5
===================================================================
Mark Wielaard b8b0f5
--- valgrind/coregrind/m_debuginfo/debuginfo.c	(revision 13007)
Mark Wielaard c728a3
+++ valgrind/coregrind/m_debuginfo/debuginfo.c	(working copy)
Mark Wielaard b8b0f5
@@ -2051,30 +2051,40 @@
Mark Wielaard a928b7
 UWord evalCfiExpr ( XArray* exprs, Int ix, 
Mark Wielaard a928b7
                     CfiExprEvalContext* eec, Bool* ok )
Mark Wielaard a928b7
 {
Mark Wielaard a928b7
-   UWord wL, wR;
Mark Wielaard a928b7
+   UWord w, wL, wR;
Mark Wielaard a928b7
    Addr  a;
Mark Wielaard a928b7
    CfiExpr* e;
Mark Wielaard a928b7
    vg_assert(sizeof(Addr) == sizeof(UWord));
Mark Wielaard b8b0f5
    e = VG_(indexXA)( exprs, ix );
Mark Wielaard b8b0f5
    switch (e->tag) {
Mark Wielaard a928b7
+      case Cex_Unop:
Mark Wielaard a928b7
+         w = evalCfiExpr( exprs, e->Cex.Unop.ix, eec, ok );
Mark Wielaard a928b7
+         if (!(*ok)) return 0;
Mark Wielaard a928b7
+         switch (e->Cex.Unop.op) {
Mark Wielaard a928b7
+            case Cunop_Abs: return (Word) w < 0 ? - w : w;
Mark Wielaard a928b7
+            case Cunop_Neg: return - (Word) w;
Mark Wielaard a928b7
+            case Cunop_Not: return ~ w;
Mark Wielaard a928b7
+            default: goto unhandled;
Mark Wielaard a928b7
+         }
Mark Wielaard a928b7
+         /*NOTREACHED*/
Mark Wielaard b8b0f5
       case Cex_Binop:
Mark Wielaard b8b0f5
          wL = evalCfiExpr( exprs, e->Cex.Binop.ixL, eec, ok );
Mark Wielaard b8b0f5
          if (!(*ok)) return 0;
Mark Wielaard b8b0f5
          wR = evalCfiExpr( exprs, e->Cex.Binop.ixR, eec, ok );
Mark Wielaard b8b0f5
          if (!(*ok)) return 0;
Mark Wielaard b8b0f5
          switch (e->Cex.Binop.op) {
Mark Wielaard b8b0f5
-            case Cop_Add: return wL + wR;
Mark Wielaard b8b0f5
-            case Cop_Sub: return wL - wR;
Mark Wielaard b8b0f5
-            case Cop_And: return wL & wR;
Mark Wielaard b8b0f5
-            case Cop_Mul: return wL * wR;
Mark Wielaard b8b0f5
-            case Cop_Shl: return wL << wR;
Mark Wielaard b8b0f5
-            case Cop_Shr: return wL >> wR;
Mark Wielaard b8b0f5
-            case Cop_Eq: return wL == wR ? 1 : 0;
Mark Wielaard b8b0f5
-            case Cop_Ge: return (Word) wL >= (Word) wR ? 1 : 0;
Mark Wielaard b8b0f5
-            case Cop_Gt: return (Word) wL > (Word) wR ? 1 : 0;
Mark Wielaard b8b0f5
-            case Cop_Le: return (Word) wL <= (Word) wR ? 1 : 0;
Mark Wielaard b8b0f5
-            case Cop_Lt: return (Word) wL < (Word) wR ? 1 : 0;
Mark Wielaard b8b0f5
-            case Cop_Ne: return wL != wR ? 1 : 0;
Mark Wielaard b8b0f5
+            case Cbinop_Add: return wL + wR;
Mark Wielaard b8b0f5
+            case Cbinop_Sub: return wL - wR;
Mark Wielaard b8b0f5
+            case Cbinop_And: return wL & wR;
Mark Wielaard b8b0f5
+            case Cbinop_Mul: return wL * wR;
Mark Wielaard b8b0f5
+            case Cbinop_Shl: return wL << wR;
Mark Wielaard b8b0f5
+            case Cbinop_Shr: return wL >> wR;
Mark Wielaard b8b0f5
+            case Cbinop_Eq: return wL == wR ? 1 : 0;
Mark Wielaard b8b0f5
+            case Cbinop_Ge: return (Word) wL >= (Word) wR ? 1 : 0;
Mark Wielaard b8b0f5
+            case Cbinop_Gt: return (Word) wL > (Word) wR ? 1 : 0;
Mark Wielaard b8b0f5
+            case Cbinop_Le: return (Word) wL <= (Word) wR ? 1 : 0;
Mark Wielaard b8b0f5
+            case Cbinop_Lt: return (Word) wL < (Word) wR ? 1 : 0;
Mark Wielaard b8b0f5
+            case Cbinop_Ne: return wL != wR ? 1 : 0;
Mark Wielaard b8b0f5
             default: goto unhandled;
Mark Wielaard b8b0f5
          }
Mark Wielaard b8b0f5
          /*NOTREACHED*/
Mark Wielaard b8b0f5
Index: valgrind/coregrind/m_debuginfo/storage.c
Mark Wielaard b8b0f5
===================================================================
Mark Wielaard b8b0f5
--- valgrind/coregrind/m_debuginfo/storage.c	(revision 13007)
Mark Wielaard c728a3
+++ valgrind/coregrind/m_debuginfo/storage.c	(working copy)
Mark Wielaard b8b0f5
@@ -585,10 +585,19 @@
Mark Wielaard b8b0f5
    e.Cex.Const.con = con;
Mark Wielaard a928b7
    return (Int)VG_(addToXA)( dst, &e );
Mark Wielaard a928b7
 }
Mark Wielaard b8b0f5
-Int ML_(CfiExpr_Binop)( XArray* dst, CfiOp op, Int ixL, Int ixR )
Mark Wielaard a928b7
+Int ML_(CfiExpr_Unop)( XArray* dst, CfiUnop op, Int ix )
Mark Wielaard b8b0f5
 {
Mark Wielaard b8b0f5
    CfiExpr e;
Mark Wielaard b8b0f5
    VG_(memset)( &e, 0, sizeof(e) );
Mark Wielaard a928b7
+   e.tag = Cex_Unop;
Mark Wielaard a928b7
+   e.Cex.Unop.op  = op;
Mark Wielaard a928b7
+   e.Cex.Unop.ix = ix;
Mark Wielaard a928b7
+   return (Int)VG_(addToXA)( dst, &e );
Mark Wielaard a928b7
+}
Mark Wielaard b8b0f5
+Int ML_(CfiExpr_Binop)( XArray* dst, CfiBinop op, Int ixL, Int ixR )
Mark Wielaard b8b0f5
+{
Mark Wielaard b8b0f5
+   CfiExpr e;
Mark Wielaard b8b0f5
+   VG_(memset)( &e, 0, sizeof(e) );
Mark Wielaard b8b0f5
    e.tag = Cex_Binop;
Mark Wielaard b8b0f5
    e.Cex.Binop.op  = op;
Mark Wielaard b8b0f5
    e.Cex.Binop.ixL = ixL;
Mark Wielaard b8b0f5
@@ -612,25 +621,35 @@
Mark Wielaard b8b0f5
    return (Int)VG_(addToXA)( dst, &e );
Mark Wielaard b8b0f5
 }
Mark Wielaard b8b0f5
 
Mark Wielaard b8b0f5
-static void ppCfiOp ( CfiOp op ) 
Mark Wielaard b8b0f5
+static void ppCfiUnop ( CfiUnop op ) 
Mark Wielaard b8b0f5
 {
Mark Wielaard b8b0f5
    switch (op) {
Mark Wielaard b8b0f5
-      case Cop_Add: VG_(printf)("+"); break;
Mark Wielaard b8b0f5
-      case Cop_Sub: VG_(printf)("-"); break;
Mark Wielaard b8b0f5
-      case Cop_And: VG_(printf)("&";; break;
Mark Wielaard b8b0f5
-      case Cop_Mul: VG_(printf)("*"); break;
Mark Wielaard b8b0f5
-      case Cop_Shl: VG_(printf)("<<"); break;
Mark Wielaard b8b0f5
-      case Cop_Shr: VG_(printf)(">>"); break;
Mark Wielaard b8b0f5
-      case Cop_Eq: VG_(printf)("=="); break;
Mark Wielaard b8b0f5
-      case Cop_Ge: VG_(printf)(">="); break;
Mark Wielaard b8b0f5
-      case Cop_Gt: VG_(printf)(">"); break;
Mark Wielaard b8b0f5
-      case Cop_Le: VG_(printf)("<="); break;
Mark Wielaard b8b0f5
-      case Cop_Lt: VG_(printf)("<"); break;
Mark Wielaard b8b0f5
-      case Cop_Ne: VG_(printf)("!="); break;
Mark Wielaard b8b0f5
-      default:      vg_assert(0);
Mark Wielaard b8b0f5
+      case Cunop_Abs: VG_(printf)("abs"); break;
Mark Wielaard b8b0f5
+      case Cunop_Neg: VG_(printf)("-"); break;
Mark Wielaard b8b0f5
+      case Cunop_Not: VG_(printf)("~"); break;
Mark Wielaard b8b0f5
+      default:        vg_assert(0);
Mark Wielaard b8b0f5
    }
Mark Wielaard b8b0f5
 }
Mark Wielaard b8b0f5
 
Mark Wielaard b8b0f5
+static void ppCfiBinop ( CfiBinop op ) 
Mark Wielaard b8b0f5
+{
Mark Wielaard b8b0f5
+   switch (op) {
Mark Wielaard b8b0f5
+      case Cbinop_Add: VG_(printf)("+"); break;
Mark Wielaard b8b0f5
+      case Cbinop_Sub: VG_(printf)("-"); break;
Mark Wielaard b8b0f5
+      case Cbinop_And: VG_(printf)("&";; break;
Mark Wielaard b8b0f5
+      case Cbinop_Mul: VG_(printf)("*"); break;
Mark Wielaard b8b0f5
+      case Cbinop_Shl: VG_(printf)("<<"); break;
Mark Wielaard b8b0f5
+      case Cbinop_Shr: VG_(printf)(">>"); break;
Mark Wielaard b8b0f5
+      case Cbinop_Eq:  VG_(printf)("=="); break;
Mark Wielaard b8b0f5
+      case Cbinop_Ge:  VG_(printf)(">="); break;
Mark Wielaard b8b0f5
+      case Cbinop_Gt:  VG_(printf)(">"); break;
Mark Wielaard b8b0f5
+      case Cbinop_Le:  VG_(printf)("<="); break;
Mark Wielaard b8b0f5
+      case Cbinop_Lt:  VG_(printf)("<"); break;
Mark Wielaard b8b0f5
+      case Cbinop_Ne:  VG_(printf)("!="); break;
Mark Wielaard b8b0f5
+      default:         vg_assert(0);
Mark Wielaard b8b0f5
+   }
Mark Wielaard b8b0f5
+}
Mark Wielaard a928b7
+
Mark Wielaard b8b0f5
 static void ppCfiReg ( CfiReg reg )
Mark Wielaard a928b7
 {
Mark Wielaard b8b0f5
    switch (reg) {
Mark Wielaard b8b0f5
@@ -664,11 +683,17 @@
Mark Wielaard b8b0f5
       case Cex_Const: 
Mark Wielaard b8b0f5
          VG_(printf)("0x%lx", e->Cex.Const.con); 
Mark Wielaard b8b0f5
          break;
Mark Wielaard b8b0f5
+      case Cex_Unop: 
Mark Wielaard b8b0f5
+         ppCfiUnop(e->Cex.Unop.op);
Mark Wielaard b8b0f5
+         VG_(printf)("(");
Mark Wielaard b8b0f5
+         ML_(ppCfiExpr)(src, e->Cex.Unop.ix);
Mark Wielaard b8b0f5
+         VG_(printf)(")");
Mark Wielaard b8b0f5
+         break;
Mark Wielaard b8b0f5
       case Cex_Binop: 
Mark Wielaard b8b0f5
          VG_(printf)("(");
Mark Wielaard b8b0f5
          ML_(ppCfiExpr)(src, e->Cex.Binop.ixL);
Mark Wielaard b8b0f5
          VG_(printf)(")");
Mark Wielaard b8b0f5
-         ppCfiOp(e->Cex.Binop.op);
Mark Wielaard b8b0f5
+         ppCfiBinop(e->Cex.Binop.op);
Mark Wielaard b8b0f5
          VG_(printf)("(");
Mark Wielaard b8b0f5
          ML_(ppCfiExpr)(src, e->Cex.Binop.ixR);
Mark Wielaard b8b0f5
          VG_(printf)(")");
Mark Wielaard b8b0f5
Index: valgrind/coregrind/m_debuginfo/priv_storage.h
Mark Wielaard b8b0f5
===================================================================
Mark Wielaard b8b0f5
--- valgrind/coregrind/m_debuginfo/priv_storage.h	(revision 13007)
Mark Wielaard c728a3
+++ valgrind/coregrind/m_debuginfo/priv_storage.h	(working copy)
Mark Wielaard b8b0f5
@@ -279,23 +279,31 @@
Mark Wielaard a928b7
 
Mark Wielaard a928b7
 typedef
Mark Wielaard a928b7
    enum {
Mark Wielaard b8b0f5
-      Cop_Add=0x321,
Mark Wielaard b8b0f5
-      Cop_Sub,
Mark Wielaard b8b0f5
-      Cop_And,
Mark Wielaard b8b0f5
-      Cop_Mul,
Mark Wielaard b8b0f5
-      Cop_Shl,
Mark Wielaard b8b0f5
-      Cop_Shr,
Mark Wielaard b8b0f5
-      Cop_Eq,
Mark Wielaard b8b0f5
-      Cop_Ge,
Mark Wielaard b8b0f5
-      Cop_Gt,
Mark Wielaard b8b0f5
-      Cop_Le,
Mark Wielaard b8b0f5
-      Cop_Lt,
Mark Wielaard b8b0f5
-      Cop_Ne
Mark Wielaard a928b7
+      Cunop_Abs=0x231,
Mark Wielaard a928b7
+      Cunop_Neg,
Mark Wielaard a928b7
+      Cunop_Not
Mark Wielaard b8b0f5
    }
Mark Wielaard b8b0f5
-   CfiOp;
Mark Wielaard a928b7
+   CfiUnop;
Mark Wielaard b8b0f5
 
Mark Wielaard b8b0f5
 typedef
Mark Wielaard b8b0f5
    enum {
Mark Wielaard b8b0f5
+      Cbinop_Add=0x321,
Mark Wielaard b8b0f5
+      Cbinop_Sub,
Mark Wielaard b8b0f5
+      Cbinop_And,
Mark Wielaard b8b0f5
+      Cbinop_Mul,
Mark Wielaard b8b0f5
+      Cbinop_Shl,
Mark Wielaard b8b0f5
+      Cbinop_Shr,
Mark Wielaard b8b0f5
+      Cbinop_Eq,
Mark Wielaard b8b0f5
+      Cbinop_Ge,
Mark Wielaard b8b0f5
+      Cbinop_Gt,
Mark Wielaard b8b0f5
+      Cbinop_Le,
Mark Wielaard b8b0f5
+      Cbinop_Lt,
Mark Wielaard b8b0f5
+      Cbinop_Ne
Mark Wielaard b8b0f5
+   }
Mark Wielaard b8b0f5
+   CfiBinop;
Mark Wielaard a928b7
+
Mark Wielaard a928b7
+typedef
Mark Wielaard a928b7
+   enum {
Mark Wielaard a928b7
       Creg_IA_SP=0x213,
Mark Wielaard a928b7
       Creg_IA_BP,
Mark Wielaard a928b7
       Creg_IA_IP,
Mark Wielaard b8b0f5
@@ -313,6 +321,7 @@
Mark Wielaard b8b0f5
       Cex_Undef=0x123,
Mark Wielaard b8b0f5
       Cex_Deref,
Mark Wielaard a928b7
       Cex_Const,
Mark Wielaard b8b0f5
+      Cex_Unop,
Mark Wielaard a928b7
       Cex_Binop,
Mark Wielaard a928b7
       Cex_CfiReg,
Mark Wielaard b8b0f5
       Cex_DwReg
Mark Wielaard b8b0f5
@@ -332,7 +341,11 @@
Mark Wielaard b8b0f5
             UWord con;
Mark Wielaard b8b0f5
          } Const;
Mark Wielaard a928b7
          struct {
Mark Wielaard b8b0f5
-            CfiOp op;
Mark Wielaard a928b7
+            CfiUnop op;
Mark Wielaard a928b7
+            Int ix;
Mark Wielaard a928b7
+         } Unop;
Mark Wielaard b8b0f5
+         struct {
Mark Wielaard b8b0f5
+            CfiBinop op;
Mark Wielaard b8b0f5
             Int ixL;
Mark Wielaard b8b0f5
             Int ixR;
Mark Wielaard b8b0f5
          } Binop;
Mark Wielaard b8b0f5
@@ -350,7 +363,8 @@
Mark Wielaard b8b0f5
 extern Int ML_(CfiExpr_Undef) ( XArray* dst );
Mark Wielaard b8b0f5
 extern Int ML_(CfiExpr_Deref) ( XArray* dst, Int ixAddr );
Mark Wielaard b8b0f5
 extern Int ML_(CfiExpr_Const) ( XArray* dst, UWord con );
Mark Wielaard b8b0f5
-extern Int ML_(CfiExpr_Binop) ( XArray* dst, CfiOp op, Int ixL, Int ixR );
Mark Wielaard b8b0f5
+extern Int ML_(CfiExpr_Unop)  ( XArray* dst, CfiUnop op, Int ix );
Mark Wielaard b8b0f5
+extern Int ML_(CfiExpr_Binop) ( XArray* dst, CfiBinop op, Int ixL, Int ixR );
Mark Wielaard a928b7
 extern Int ML_(CfiExpr_CfiReg)( XArray* dst, CfiReg reg );
Mark Wielaard a928b7
 extern Int ML_(CfiExpr_DwReg) ( XArray* dst, Int reg );
Mark Wielaard a928b7