digitalmars.D - gdb seg fault
- Chris (12/12) Feb 18 2006 Does anybody know why when trying to debug a "Hello world" program with
- John Demme (14/29) Feb 18 2006 I bet you're using the -g flag with dmd. If you disable that, gdb doesn...
- Chris (16/51) Feb 19 2006 Sorry,
- John Demme (2/15) Feb 19 2006 I don't think GDB supports windows executables.
- Chris (5/40) Feb 19 2006 Sorry for asking this but how do I apply this patch? I'm not used to
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (6/8) Feb 19 2006 RTFM :-)
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); }
Feb 18 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); }
Feb 18 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); }
Feb 19 2006
Chris wrote: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 recognizedI don't think GDB supports windows executables.
Feb 19 2006
Sorry for asking this but how do I apply this patch? I'm not used to compiling OSS. Where should I look for more info? Thank you for the tips Chris 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); }
Feb 19 2006
Chris wrote:Sorry for asking this but how do I apply this patch? I'm not used to compiling OSS. Where should I look for more info?RTFM :-) http://www.gnu.org/software/diffutils/manual/html_node/index.html Usually invoked something like: "patch -p1 -i whatever.patch" You can use the GNU --dry-run flag first, for a practice run... --anders
Feb 19 2006