gdb seg fault

John Demme me at teqdruid.com
Sat Feb 18 22:38:13 PST 2006


I bet you're using the -g flag with dmd.  If you disable that, gdb doesn't
crash. (Right?)

If the above is true, then this happens because gdb uses the DWARF2
debugging information standard, whereas the little information that DMD
outputs is in DWARF3... The only practical difference is that D has a
language tag in DWARF3, so gdb can know what language the program is in. 
Unpatched versions of gdb, however, don't have a clue about D and when they
read the tag, just crash.  I have a patch for GDB on dsource.org that adds
the tag to GDB as well as adds symbol demangling.  I'd suggest you give it
a try.

Alternatively, compile with the -gc flag instead to tell DMD to lie and
output C's debugging tag.

~John Demme

Chris wrote:

> Does anybody know why when trying to debug a "Hello world" program with
> gdb under cygwin, it causes a segmentation fault? But it runs fine, when
> it is not debugged.
> 
> Here is the program:
> 
> import std.stdio;
> 
> void main()
> {
>      int i = 1;
>      i++;
>      printf("Good bye");
>      writefln("\n%d", i);
> }




More information about the Digitalmars-d mailing list