Using Clang ToT (I believe this would easily reproduce with the recently released 3.2 as well, perhaps with older versions too) to compile the following program: int func(int p) { int x = p + 3; return x; } int main() { return func(3); } Then loading that into GDB (7.5) & executing the following: trace 3 actions collect x end At the "collect" point (reproduces when using "collect q" instead) GDB has the following error: ../../gdb-7.5.x/gdb/tracepoint.c:665: internal-error: expression has min height < 0 A problem internal to GDB has been detected, further debugging may prove unreliable. It'd be nice if GDB didn't fail. Beyond that, there's nothing in Clang's debug info that seems unreasonable for this, but evidently there's /some/ difference between GCC 4.7 and Clang's output here because GCC's output works just fine. Perhaps the location information is broken in some way. (advice on that would be appreciated, though not required - this bug is merely about the internal error)
Could you attach the executable? That would help.
Created attachment 6799 [details] x86 assembly for trace.c from Clang x86 assembly for trace.c, you can use gcc to assemble this if you like (ie: Clang is not required): gcc-4.7 trace.s && gdb a.out < script (where script is the commands mentioned in the initial bug description)
The bug is that we don't require_rvalue after computing the frame base. Testing a patch.
Created attachment 6801 [details] x86 assembly for trace.c from Clang with frame pointers Since you mentioned something about frames, that reminded me that Clang does tend to be a bit conservative about frame pointers - so I thought I should mention/demonstrate (in case it's relevant) that this bug does still reproduce when I force Clang to emit frame pointers.
(In reply to comment #4) > Created attachment 6801 [details] > x86 assembly for trace.c from Clang with frame pointers > > Since you mentioned something about frames, that reminded me that Clang does > tend to be a bit conservative about frame pointers - so I thought I should > mention/demonstrate (in case it's relevant) that this bug does still reproduce > when I force Clang to emit frame pointers. It isn't about frame pointers but about the DW_AT_frame_base. GCC usually uses DW_OP_call_frame_cfa. clang is emitting <41> DW_AT_frame_base : 1 byte block: 56 (DW_OP_reg6 (rbp)) The DWARF->AX translator was mishandling this -- just an oversight there. I have a patch, and it works; I just need to turn the .s into a test case.
CVSROOT: /cvs/src Module name: src Changes by: tromey@sourceware.org 2013-01-18 18:32:35 Modified files: gdb : ChangeLog dwarf2loc.c gdb/testsuite : ChangeLog Added files: gdb/testsuite/gdb.dwarf2: trace-crash.S trace-crash.exp Log message: PR c++/14999: * dwarf2loc.c (dwarf2_compile_expr_to_ax) <DW_OP_fbreg>: Call require_rvalue. gdb/testsuite * gdb.dwarf2/trace-crash.s: New file. * gdb.dwarf2/trace-crash.exp: New file. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.15035&r2=1.15036 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/dwarf2loc.c.diff?cvsroot=src&r1=1.160&r2=1.161 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3518&r2=1.3519 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.dwarf2/trace-crash.S.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.dwarf2/trace-crash.exp.diff?cvsroot=src&r1=NONE&r2=1.1
Fix checked in.