Summary: | Valgrind crashes with unhandled DW_OP_ opcode 0x2a in gcc (Debian 4.6.1-1) 4.6.1 with debian unstable x64 | ||
---|---|---|---|
Product: | [Developer tools] valgrind | Reporter: | Dimitris Zenios <dimitris.zenios> |
Component: | memcheck | Assignee: | Julian Seward <jseward> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | kde, tom |
Priority: | NOR | ||
Version: | 3.7 SVN | ||
Target Milestone: | --- | ||
Platform: | Unlisted Binaries | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: |
Implement DW_OP_ge and friends
Implement DWARF comparison and shift operators valgrind-relational.patch |
Description
Dimitris Zenios
2011-07-04 07:23:41 UTC
I am having exactly the same problem after just having upgraded to the new Debian version of valgrind. It seems to happen for all programs as well: derick@whisky:~/dev/Twig$ valgrind /bin/ls ==6707== Memcheck, a memory error detector ==6707== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==6707== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info ==6707== Command: /bin/ls ==6707== --6707-- Warning: DWARF2 CFI reader: unhandled DW_OP_ opcode 0x2a valgrind: m_debuginfo/readdwarf.c:2338 (copy_convert_CfiExpr_tree): Assertion 'srcix >= 0 && srcix < VG_(sizeXA)(srcxa)' failed. ==6707== at 0x3802CFF6: ??? (in /usr/lib/valgrind/memcheck-amd64-linux) I've also added a Debian bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=632666 Created attachment 61606 [details]
Implement DW_OP_ge and friends
I don't know if it will fix the assertion or not, but this patch should implement the missing opcode (which is DW_OP_ge).
This patch indeed fixes the original error, but I am now getting a new one: derick@whisky:~$ /home/derick/local/bin/valgrind /bin/ls ==22174== Memcheck, a memory error detector ==22174== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==22174== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info ==22174== Command: /bin/ls ==22174== --22174-- Warning: DWARF2 CFI reader: unhandled DW_OP_ opcode 0x24 valgrind: m_debuginfo/readdwarf.c:2338 (copy_convert_CfiExpr_tree): Assertion 'srcix >= 0 && srcix < VG_(sizeXA)(srcxa)' failed. ==22174== at 0x3804AE36: report_and_quit (m_libcassert.c:193) Created attachment 61618 [details]
Implement DWARF comparison and shift operators
Derick sent me the failing object, which was actually one of valgrind's preload libraries in his newly built patched version. It was built with gcc 4.6.1 and the problem seems to be the default CFA expression in one of the FDEs which looks like:
DW_OP_breg7 (rsp): 8
DW_OP_breg16 (rip): 0;
DW_OP_lit15
DW_OP_and
DW_OP_lit11
DW_OP_ge
DW_OP_lit3
DW_OP_shl
DW_OP_plus
Which decodes as:
if %rip & 0xf >= 11
cfa = %rsp + 8
else
cfa = %rsp
Which is quite funky but anyway the good news it that it looks like DW_OP_shl is the only other thing we need so this new patch adds that (and DW_OP_shr for good measure). I've also fixed the relational ops, which I had back to front due to the DWARF 2 standard being unclear - it has been clarified in the DWARF 3 spec.
Still no idea if it will fix the assertion of course...
Derick has confirmed the patch fixes the problem so I have committed it as r11856. I can confirm that this new patches fixes valgrind for me \o/. Created attachment 62050 [details] valgrind-relational.patch Unfortunately this isn't correct, DW_OP_{ge,gt,le,lt} as per DWARF{2,3,4} perform signed comparisons instead of unsigned. In the case of the PLT unwind info that triggered this (see http://sources.redhat.com/ml/binutils/2011-06/msg00225.html ) it doesn't matter as the value is masked and so is always non-negative (and the second operand is constant), but it could matter elsewhere. BTW, it is strange that shr operation has been added and shra has not (arithmetic right shift). It's not really strange when you consider that shr is dead easy to implement in C and shra is much harder ;-) Patch committed as r11904. |