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

Robert Clipsham robert at octarineparrot.com
Thu Apr 1 05:31:06 PDT 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?
>
>

I've spent a lot of time on this, and with the patch from bug #3987 
applied debugging info should work, providing binaries are compiled with 
-gc and not -g :)


More information about the Digitalmars-d-debugger mailing list