有時使用GDB做debug,會發生以下的warnning...
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
這意思是gdb做shared library的loading不正確,可以用以下的gdb command看看shared library的結果...
以下表示沒有任何shared library被load進gdb debugger中
(gdb) info shared
No shared libraries loaded at this time.
(gdb)
假設TARGET是ARM,rootfs於/home/nfs/arm
以下表示shared library symbol被load進gdb debugger,但不正確(因為gdb load host中的library)
(gdb) info shared
From To Syms Read Shared Object Library
0x50002080 0x5001a650 Yes /lib/ld-linux.so.2
0x500325b0 0x5003d118 Yes /usr/lib/libmad.so.0
0x5005d598 0x50064f58 Yes /usr/lib/libid3tag.so.0
0x5006d754 0x500782ec Yes /usr/lib/libz.so.1
0x5009a328 0x50138eec Yes /lib/libm.so.6
0x501b2ac8 0x502af008 Yes /lib/libc.so.6
(gdb)
GDB中的一個command....
set solib-search-path PATH
可以指定GDB尋找正確的shared library....
(gdb) set solib-search-path /home/nfs/arm/lib:/home/nfs/arm/usr/lib
(gdb) info shared
From To Syms Read Shared Object Library
0x50002080 0x5001a650 Yes /home/nfs/arm/lib/ld-linux.so.2
0x500325b0 0x5003d118 Yes /home/nfs/arm/usr/lib/libmad.so.0
0x5005d598 0x50064f58 Yes /home/nfs/arm/usr/lib/libid3tag.so.0
0x5006d754 0x500782ec Yes /home/nfs/arm/usr/lib/libz.so.1
0x5009a328 0x50138eec Yes /home/nfs/arm/lib/libm.so.6
0x501b2ac8 0x502af008 Yes /home/nfs/arm/lib/libc.so.6
(gdb)