Short version of question:
How can I get gdb to use the debugging symbols for libc
?
Longer version:
I am debugging a program with gdb and I want to see information about a futex used by libc
. However, at some point during debugging I get output such as:
Catchpoint 2 (call to syscall futex), 0x00007ffff772b73e in ?? () from /lib/libc.so.6
(gdb) bt
#0 0x00007ffff772b73e in ?? () from /lib/libc.so.6
#1 0x00007ffff767fb90 in ?? () from /lib/libc.so.6
#2 0x00007ffff767a4c0 in vfprintf () from /lib/libc.so.6
#3 0x00007ffff768565a in printf () from /lib/libc.so.6
....
When I run info sharedlibrary
in gdb at the breakpoint I see:
(gdb) info sharedlibrary
From To Syms Read Shared Object Library
0x00007ffff7dddaf0 0x00007ffff7df6704 Yes (*) /lib64/ld-linux-x86-64.so.2
0x00007ffff7bc53e0 0x00007ffff7bd1388 Yes (*) /lib/libpthread.so.0
0x00007ffff79ba190 0x00007ffff79bd7d8 Yes (*) /lib/librt.so.1
0x00007ffff76538c0 0x00007ffff7766c60 Yes (*) /lib/libc.so.6
0x00007ffff6c1fd80 0x00007ffff6c303c8 Yes (*) /lib/libgcc_s.so.1
(*): Shared library is missing debugging information.
And when I run ldd
I see:
linux-vdso.so.1 => (0x00007ffff7fde000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007ffff7dbf000)
librt.so.1 => /lib/librt.so.1 (0x00007ffff7bb6000)
libc.so.6 => /lib/libc.so.6 (0x00007ffff7833000)
/lib64/ld-linux-x86-64.so.2 (0x00007ffff7fdf000)
I am using Ubuntu 10.04 and I think that the version of libc
with debug symbols is in /usr/lib/debug/lib
. I tried setting my LD_LIBRARY_PATH
variable to have this at the front of the path but that did not seem to make a difference.
I'm not completely clear on how the program chooses which shared libraries to load, whether this is set at runtime or compile time (I sort of assumed runtime but now I'm not sure). So information on how to get gdb to use the debug version of libc
is appreciated.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…