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

Robert Clipsham robert at octarineparrot.com
Fri Mar 12 08:53:05 PST 2010


On 12/03/10 16:34, Vladimir Panteleev wrote:
> Hi all,
>
> I'm trying to debug some random crashes of some D services running on a
> Linux headless server.
> I have compiled/linked my programs and Phobos with -g and without -O
> (using DMD), and applied the gdb patches from
> http://dsource.org/projects/gdb-patches/ .
> I'm running a script based on
> https://wiki.ubuntu.com/Backtrace#Summary%20in%20script%20form to
> automatically record the backtrace and restart the program.
> However, gdb still doesn't print very nice backtraces. Here's an example
> output:
>
>
> [Thread debugging using libthread_db enabled]
> [New Thread 0xf75506d0 (LWP 29591)]
> Die: DW_TAG_<unknown> (abbrev = 9, offset = 449149)
> has children: FALSE
> attributes:
> DW_AT_byte_size (DW_FORM_data1) constant: 8
> DW_AT_type (DW_FORM_ref4) constant ref: 449143 (adjusted)
> Dwarf Error: Cannot find type of die [in module
> /home/wnbot/wahostbot/HostingBuddy]
> #0 0x080a72aa in _aaIn (aa={a = 0xf7461410}, keyti=0x8136969) at
> internal/aaA.d:253
> pkey = (void *) 0xff9439d8
> len = 97
> key_hash = 145249
> i = 40
> e = (struct aaA.aaA *) 0x180002
> c = 50Die: DW_TAG_<unknown> (abbrev = 4, offset = 52531)
> has children: FALSE
> attributes:
> DW_AT_byte_size (DW_FORM_data1) constant: 8
> DW_AT_type (DW_FORM_ref4) constant ref: 52523 (adjusted)
>
> Dwarf Error: Cannot find type of die [in module
> /home/wnbot/wahostbot/HostingBuddy]
>
>
> So, what's the proper way to set up D debugging on Linux? Should I just
> look into gdc?
>
>

It seems dmd is producing bad debug info here, you should report a bug 
if you can narrow it down to a test case which still does that. I've 
never had a problem using ldc with gdb and gdb-patches, so you could try 
that if you're using D1/Tango. Otherwise I don't know what to suggest, 
until the dmd bug is fixed... Other people have had similar problems, so 
if you manage to get a test case that you can put in bugzilla it might 
catch Walter's attention, getting gdb playing nicely with D seems to be 
important to him :)


More information about the Digitalmars-d-debugger mailing list