Skip site navigation (1)Skip section navigation (2)
Date:      Tue,  1 May 2012 20:20:53 -0400 (EDT)
From:      Brett Gmoser <bgmoser@codexterous.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        lichray@gmail.com
Subject:   ports/167506: valgrind not working on FreeBSD 9 (maybe others), fixed upstream, patch attached
Message-ID:  <20120502002053.455154501E@europa.cyber-lead.com>
Resent-Message-ID: <201205020030.q420UBa3090221@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         167506
>Category:       ports
>Synopsis:       valgrind not working on FreeBSD 9 (maybe others), fixed upstream, patch attached
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 02 00:30:11 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Brett Gmoser
>Release:        FreeBSD 9.0-RELEASE amd64
>Organization:
None
>Environment:
System: FreeBSD europa.cyber-lead.com 9.0-RELEASE FreeBSD 9.0-RELEASE #16: Wed Apr 18 07:09:54 EDT 2012 root@europa.cyber-lead.com:/usr/obj/usr/src/sys/EUROPA 

  Freebsd9 amd64 devel/valgrind port
>Description:
  Serious severity because it renders valgrind useless on FreeBSD 9. Using valgrind on any binary on my system produces the following:
  valgrind: m_debuginfo/readdwarf.c:2338 (copy_convert_CfiExpr_tree): Assertion 'srcix >= 0 && srcix < VG_(sizeXA)(srcxa)' failed.
>How-To-Repeat:
  Use valgrind on any binary on my system.
>Fix:
  This problem has been fixed upstream. More information is available here:

  https://bugs.kde.org/show_bug.cgi?id=277045

  Applying the patches there fixes the problem. For your convenience, I've pasted the patches here:

Index: coregrind/m_debuginfo/readdwarf.c
===================================================================
--- coregrind/m_debuginfo/readdwarf.c	(revision 11852)
+++ coregrind/m_debuginfo/readdwarf.c	(working copy)
@@ -2899,6 +2899,22 @@
             op = Cop_And; opname = "and"; goto binop;
          case DW_OP_mul:
             op = Cop_Mul; opname = "mul"; goto binop;
+         case DW_OP_shl:
+            op = Cop_Shl; opname = "shl"; goto binop;
+         case DW_OP_shr:
+            op = Cop_Shr; opname = "shr"; goto binop;
+         case DW_OP_eq:
+            op = Cop_Eq; opname = "eq"; goto binop;
+         case DW_OP_ge:
+            op = Cop_Ge; opname = "ge"; goto binop;
+         case DW_OP_gt:
+            op = Cop_Gt; opname = "gt"; goto binop;
+         case DW_OP_le:
+            op = Cop_Le; opname = "le"; goto binop;
+         case DW_OP_lt:
+            op = Cop_Lt; opname = "lt"; goto binop;
+         case DW_OP_ne:
+            op = Cop_Ne; opname = "ne"; goto binop;
          binop:
             POP( ix );
             POP( ix2 );
Index: coregrind/m_debuginfo/debuginfo.c
===================================================================
--- coregrind/m_debuginfo/debuginfo.c	(revision 11852)
+++ coregrind/m_debuginfo/debuginfo.c	(working copy)
@@ -1880,6 +1880,14 @@
             case Cop_Sub: return wL - wR;
             case Cop_And: return wL & wR;
             case Cop_Mul: return wL * wR;
+            case Cop_Shl: return wL << wR;
+            case Cop_Shr: return wL >> wR;
+            case Cop_Eq: return wL == wR ? 1 : 0;
+            case Cop_Ge: return wL >= wR ? 1 : 0;
+            case Cop_Gt: return wL > wR ? 1 : 0;
+            case Cop_Le: return wL <= wR ? 1 : 0;
+            case Cop_Lt: return wL < wR ? 1 : 0;
+            case Cop_Ne: return wL != wR ? 1 : 0;
             default: goto unhandled;
          }
          /*NOTREACHED*/
Index: coregrind/m_debuginfo/storage.c
===================================================================
--- coregrind/m_debuginfo/storage.c	(revision 11852)
+++ coregrind/m_debuginfo/storage.c	(working copy)
@@ -603,6 +603,14 @@
       case Cop_Sub: VG_(printf)("-"); break;
       case Cop_And: VG_(printf)("&"); break;
       case Cop_Mul: VG_(printf)("*"); break;
+      case Cop_Shl: VG_(printf)("<<"); break;
+      case Cop_Shr: VG_(printf)(">>"); break;
+      case Cop_Eq: VG_(printf)("=="); break;
+      case Cop_Ge: VG_(printf)(">="); break;
+      case Cop_Gt: VG_(printf)(">"); break;
+      case Cop_Le: VG_(printf)("<="); break;
+      case Cop_Lt: VG_(printf)("<"); break;
+      case Cop_Ne: VG_(printf)("!="); break;
       default:      vg_assert(0);
    }
 }
Index: coregrind/m_debuginfo/priv_storage.h
===================================================================
--- coregrind/m_debuginfo/priv_storage.h	(revision 11852)
+++ coregrind/m_debuginfo/priv_storage.h	(working copy)
@@ -249,7 +249,15 @@
       Cop_Add=0x321,
       Cop_Sub,
       Cop_And,
-      Cop_Mul
+      Cop_Mul,
+      Cop_Shl,
+      Cop_Shr,
+      Cop_Eq,
+      Cop_Ge,
+      Cop_Gt,
+      Cop_Le,
+      Cop_Lt,
+      Cop_Ne
    }
    CfiOp;
 
--- coregrind/m_debuginfo/debuginfo.c.jj  2011-07-21 16:35:56.000000000 +0200
+++ coregrind/m_debuginfo/debuginfo.c 2011-07-21 16:39:22.000000000 +0200
@@ -1883,10 +1883,10 @@ UWord evalCfiExpr ( XArray* exprs, Int i
             case Cop_Shl: return wL << wR;
             case Cop_Shr: return wL >> wR;
             case Cop_Eq: return wL == wR ? 1 : 0;
-            case Cop_Ge: return wL >= wR ? 1 : 0;
-            case Cop_Gt: return wL > wR ? 1 : 0;
-            case Cop_Le: return wL <= wR ? 1 : 0;
-            case Cop_Lt: return wL < wR ? 1 : 0;
+            case Cop_Ge: return (Word) wL >= (Word) wR ? 1 : 0;
+            case Cop_Gt: return (Word) wL > (Word) wR ? 1 : 0;
+            case Cop_Le: return (Word) wL <= (Word) wR ? 1 : 0;
+            case Cop_Lt: return (Word) wL < (Word) wR ? 1 : 0;
             case Cop_Ne: return wL != wR ? 1 : 0;
             default: goto unhandled;
          }

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120502002053.455154501E>