What's the proper way to debug D programs with GDB?

grauzone none at example.net
Fri Mar 19 14:37:50 PDT 2010


Robert Clipsham wrote:
> On 19/03/10 00:34, Bernard Helyer wrote:
>> http://omploader.org/iM3ZudA
>>
>> There you go. D2, run build.debug.sh to build. Modify the script to add
>> options and the like. Built with `-gc` list _Dmain or break _Dmain
>> doesn't work, if you force a segfault (remove the comments from the
>> first few lines of ator.main and compile with -noboundscheck to cause
>> one) bt doesn't work, etc, etc.
> 
> Thanks! I've managed to work this down to a 2 line test case:
> ----
> void function() myfunc;
> void main(){}
> ----

Wow, good work...

> Which errors with:
> ----
> Die: DW_TAG_padding (abbrev = 0, offset = 0)
>         has children: FALSE
>         attributes:
> Dwarf Error: Cannot find type of die [in module /tmp/test]
> ----
> 
> Compile with either dmd -gc test.d or dmd -g test.d. I'll spend some 
> more time with it now and see if I can figure out a cause so we can give 
> a more useful bug report, if not I'll open a bug as is. If anyone else 
> is getting different errors from gdb when using -gc, let me know and I 
> can narrow them down too.

If I compile it with dmd -gc test.d, start gdb (version "7.0.1-debian"), 
and type "break _Dmain", I just get "Dwarf Error: Cannot find DIE at 0x0 
referenced from DIE at 0x46 [in module /tmp/test]".

This is with dmd v1.055 without gdb patches (but some other custom 
patches, though I think none should affect the debugging infos).


More information about the Digitalmars-d-debugger mailing list