gdb seg fault

Chris central_p at hotmail.com
Sun Feb 19 00:51:30 PST 2006


Sorry,

I've forgot to mention that I was using gdc.

Files compiled with dmd are not recognized by GDB.

Here is the message:
$ gdb d.exe
GNU gdb 6.3.50_2004-12-28-cvs (cygwin-special)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you 
arewelcome to change it and/or distribute copies of it under certain 
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"..."/cygdrive/e/home/My 
Documents/CodeBlocks Projects/d/d.exe": not in executable format: File 
format not recognized

John Demme wrote:
> 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