www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - help needed with gdb

reply eles <eles eles.com> writes:
hello everybody,

here is my setup:
Linux system 2.6.32-22-generic #33-Ubuntu SMP Wed Apr 28 13:28:05 UTC 2010
x86_64 GNU/Linux

and here is gdbtest.d

import std.stdio;

int x=0;
string t="hello!";

int main(){
	writefln("x=%d",x);
	writefln("t=%s",t);
	return 0;
}

I compiled the latest weekly buid of gdb (7.1.50.20100519) and installed dmd
2.046 via the deb file (including the multilib tools).

then I tried to debug gdbtest. I received the errors below.

user system:~/Desktop/temp$ dmd gdbtest.d -g
user system:~/Desktop/temp$ ./gdbtest
x=0
t=hello!
user system:~/Desktop/temp$ gdb --version
GNU gdb (GDB) 7.1.50.20100519
Copyright (C) 2010 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 "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
user system:~/Desktop/temp$ gdb ./gdbtest
GNU gdb (GDB) 7.1.50.20100519
Copyright (C) 2010 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 "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/felix/Desktop/temp/gdbtest...done.
(gdb) break main
Breakpoint 1 at 0x804efd7
(gdb) run
Starting program: /home/felix/Desktop/temp/gdbtest
warning: the debug information found in "/lib/ld-2.11.1.so" does not match "/
lib/ld-linux.so.2" (CRC mismatch).

[Thread debugging using libthread_db enabled]

Breakpoint 1, 0x0804efd7 in main ()
(gdb) next
Single stepping until exit from function main,
which has no line number information.
x=0
t=hello!
0xf7e45bd6 in __libc_start_main () from /lib32/libc.so.6
(gdb)
Single stepping until exit from function __libc_start_main,
which has no line number information.

Program exited normally.
(gdb)

as you see, the debug session was unsuccesful. can anybody enlighten me why?
what is the line "warning: the debug information found in "/lib/ld-2.11.1.so"
does not match "/lib/ld-linux.so.2" (CRC mismatch)."?

thank you

eles
May 19 2010
parent Robert Clipsham <robert octarineparrot.com> writes:
On 19/05/10 20:45, eles wrote:
 as you see, the debug session was unsuccesful. can anybody enlighten me why?
 what is the line "warning: the debug information found in "/lib/ld-2.11.1.so"
 does not match "/lib/ld-linux.so.2" (CRC mismatch)."?

 thank you

 eles

You'd need to talk to the gdb devs about this, I'm not sure what this error means, given that it's to do with .so's that aren't part of the D distribution I'd guess it's a general gdb error. Try the following C code and see if you get the same error when trying to debug it: ---- int main() { return 0; } ---- $ gcc -g test.c -o test $ gdb ./test <run the same commands as before in gdb> If you get the same errors it's either a gdb problem or a problem with your set up. As a side note, if you want to break at the main() function in your D file, you need to do 'break _Dmain'.
May 19 2010