It is impossible to debug code compiled with dmd
Robert Clipsham
robert at octarineparrot.com
Wed Mar 31 13:50:53 PDT 2010
On 31/03/10 21:37, Walter Bright wrote:
> Please let me know when you have dwarf.c patches ready, and thank you
> for trying to figure this out.
The first one is in bugzilla, you just need to comment out/remove the lines:
abuf.writeByte(DW_AT_type); abuf.writeByte(DW_FORM_ref4);
(at about line 1447, in the TYjfunc case of the switch statement in
dwarf_typidx()). And:
infobuf->write32(nextidx); // DW_AT_type
At about line 1469 of dwarf.c. This fixes debug info for druntime,
phobos, and a couple of test projects (the debug info looks identical to
the equivalent output from clang too).
There is one case which this patch doesn't solve, and that's for
function pointers in the form:
T function(U function(V)) foobar;
Where T, U and V are any type. If you look at the .debug_info produced
by dmd (either before or after the above patch, use objdump --dwarf=info
testFile), you will see that it ends up writing what is parsed as a
DW_TAG_compile_unit after the second DW_TAG_formal_parameter, so it
seems some stray bytes are getting written causing the 0x1 to be
detected as the abbrev rather than what ever it was intended to be (I'm
still looking into this).
More information about the Digitalmars-d
mailing list