Problem with debugging in Linux

Qian Xu quian.xu at stud.tu-ilmenau.de
Wed Jul 15 01:28:49 PDT 2009


Hi All,

I try to debug my application with gdb. 
However the callstack information is incomplete. 

Workground looks as follows:

1. Create a test file

---- My code -----
module mymodule;
class Foo {}
void main()
{
   Foo foo;
   if (foo == foo) {} // segfault
}
---- My code -----

2. Compile it:
dmd -version=Posix -w -g -debug -O test.d -c
dmd test.o -oftarget

3. Type "ulimit -c unlimited" in terminal (in order to generate core dump)

4. Run "target" (a core dump will be generated)

5. gdb target /var/coredump/the_core_dump

6. type "bt" to see the callstack information.
#0  0x0804956a in _Dmain ()
#1  0xb7ceafc0 in ?? ()
#2  0xbfdc79c0 in ?? ()
#3  0x0804a090 in _D2rt6dmain24mainUiPPaZi7runMainMFZv ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)




Does anybody know, why gdb says "corrupt stack"?

Best regards
Qian Xu



More information about the Digitalmars-d mailing list