Mail Archives: djgpp/2015/05/25/10:37:53
> Date: Mon, 25 May 2015 14:44:08 +0200
> From: "Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de)" <djgpp AT delorie DOT com>
>
> To make the long story short: the error was to use the -ggdb flag. The djgpp
> port of gcc seems not to understand this.
Thanks for looking into this. This should be reported to the GCC
maintainers (or maybe Andris will be able to fix that regardless).
> The right flag is -gdwarf-2. It is
> also possible to compile with -gdwarf-3 and -gdwarf-4 but later the info source
> command always claims that the debug format is DWARF2. It seems to be of no
> benefit to use either the -gdwarf-3 or -gdwarf4 flag.
That's a common misconception: -gdwarf-N actually generates debug info
according to DWARF Standard version N. GDB says it's all DWARF2 for
historical reasons.
You should be able to see the difference between the various values of
N by running "objdump --dwarf" on the executable and comparing the
output. (If the output is identical, then there's another bug in the
DJGPP port of GCC; GCC 4.8.1 provided by MinGW does support N=3 and
N=4, and the results are definitely different.)
> Using -gcoff makes no sense at all for debugging because it makes
> gdb crash like this:
>
> C:\tmp\5>gdb a.exe
> GNU gdb (GDB) 7.9.1
> Copyright (C) 2015 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law. Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "--host=i786-pc-msdosdjgpp --target=djgpp".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>.
> Find the GDB manual and other documentation resources online at:
> <http://www.gnu.org/software/gdb/documentation/>.
> For help, type "help".
> Type "apropos word" to search for commands related to "word"...
> Reading symbols from a.exe...rmvfromfree: memory fouled
> Exiting due to signal SIGABRT
> Raised at eip=003f96da
> eax=005440e4 ebx=00000120 ecx=00000011 edx=00000000 esi=00000198 edi=00000198
> ebp=000001a8 esp=005440d0 program=C:\DJGPP-2.04\BIN\GDB.EXE
> cs: sel=01a7 base=02990000 limit=006affff
> ds: sel=01af base=02990000 limit=006affff
> es: sel=01af base=02990000 limit=006affff
> fs: sel=017f base=00008e80 limit=0000ffff
> gs: sel=01bf base=00000000 limit=0010ffff
> ss: sel=01af base=02990000 limit=006affff
> App stack: [00544788..004c478c] Exceptn stack: [004c46e8..004c27a8]
>
> Call frame traceback EIPs:
> 0x003f96da
>
> C:\tmp\5>
>
> I do not think it make sense to investigate this issue any more.
Too bad: it means the new GCC/GDB are of no use for debugging Emacs.
Sounds like some memory allocation error to me.
> Using -gdwarf-2 makes work gdb again at least for the test cases I have tried.
> The bt command works and also the step and next commands work as they should.
> I do not understand why -ggdb did not work. I expected the port of the compiler
> to be clever enough to know that -ggdb means -gdwarf-2 for a DJGPP port of gcc.
> But it seems to be that I am wrong.
You are right; it's a bug in GCC.
Thanks.
- Raw text -