ports/166341: devel/valgrind crash on binaries built with gcc46
Tom Russo
tvrusso at sandia.gov
Fri Mar 23 17:10:13 UTC 2012
>Number: 166341
>Category: ports
>Synopsis: devel/valgrind crash on binaries built with gcc46
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Mar 23 17:10:13 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Tom Russo
>Release: 9.0-STABLE
>Organization:
Sandia National Laboratories
>Environment:
FreeBSD sadl14834a 9.0-STABLE FreeBSD 9.0-STABLE #0: Wed Mar 21 18:26:27 MDT 2012 root at sadl14834:/usr/obj/usr/src/sys/GOLDSTEIN amd64
>Description:
While this is apparently fixed upstream, the valgrind port in FreeBSD will fail when run with binaries built by gcc 4.6. The failure is:
Warning: DWARF2 CFI reader: unhandled DW_OP_ opcode 0x2a
While this says it's just a warning, the result is a failure with many subsequent errors such as:
valgrind: m_debuginfo/readdwarf.c:2338 (copy_convert_CfiExpr_tree): Assertion 'srcix >= 0 && srcix < VG_(sizeXA)(srcxa)' failed.
==45514== at 0x3802B517: ??? (in /usr/local/lib/valgrind/memcheck-amd64-freebsd)
==45514== by 0x4050FDFDF: ???
==45514== by 0x3802CB26: ??? (in /usr/local/lib/valgrind/memcheck-amd64-freebsd)
==45514== by 0x3802B516: ??? (in /usr/local/lib/valgrind/memcheck-amd64-freebsd)
==45514== by 0x4050FDFDE: ???
Since this is fixed upstream, it is possible to backport the fix, as for example:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=632666
I am attaching a patch produced according to the scheme suggested in the link above. My patch file is a kitchen-sink patch, including all diffs needed to address the issue, not a collection of individual patch-file-name-X files as is customary in the ports system. But it works.
This will probably become unnecessary when the valgrind port is updated to a newer release, but it has been failing in this way for at least a couple of months (I first noticed it when gcc 4.5 was removed from ports and replaced by gcc 4.6).
>How-To-Repeat:
Build gcc 4.6.x, compile a program with it. Install devel/valgrind, run valgrind over the program you built. It will die.
>Fix:
Add the file attached to ports/devel/valgrind/files as "patch-valgrind-extra" and rebuild valgrind. It will no longer fail.
Patch attached with submission follows:
Index: coregrind/m_debuginfo/readdwarf.c
===================================================================
--- coregrind/m_debuginfo/readdwarf.c (revision 11855)
+++ coregrind/m_debuginfo/readdwarf.c (revision 11856)
@@ -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 11855)
+++ coregrind/m_debuginfo/debuginfo.c (revision 11856)
@@ -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 11855)
+++ coregrind/m_debuginfo/storage.c (revision 11856)
@@ -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 11855)
+++ coregrind/m_debuginfo/priv_storage.h (revision 11856)
@@ -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;
Index: coregrind/m_debuginfo/debuginfo.c
===================================================================
--- coregrind/m_debuginfo/debuginfo.c (revision 11903)
+++ coregrind/m_debuginfo/debuginfo.c (revision 11904)
@@ -1883,10 +1883,10 @@
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:
More information about the freebsd-ports-bugs
mailing list