[root@xxx memcached-1.4.5]# objdump -R memcached-debug |grep freeaddrinfo
0000000000629e10 R_X86_64_JUMP_SLOT freeaddrinfo
...
(gdb) disas freeaddrinfo
Dump of assembler code for function freeaddrinfo:
0x00000037aa4baf10 <freeaddrinfo+0>: push %rbp
0x00000037aa4baf11 <freeaddrinfo+1>: push %rbx
0x00000037aa4baf12 <freeaddrinfo+2>: mov %rdi,%rbx
So I know freeaddrinfo
is a dynamically linked function,but how to know which .so
it's defined in?
For certain low version gdb, "info symbol " could not work as you want.
So please use below method:
Run 'p symbol_name' to get symbol address
(gdb) p test_fun
$1 = {<text variable, no debug info>} 0x84bcc4 <test_fun>
Check /proc/PID/maps to find out the module which the symbol address is in.
# more /proc/23275/maps
007ce000-0085f000 r-xp 00000000 fd:00 3524598 /usr/lib/libtest.so
0x84bcc4 is in [007ce000, 0085f000]
See this answer. The info symbol freeadrinfo
is one way to find out.
On Linux and Solaris you can also use ldd
and LD_DEBUG=symbols
. For example, if you wanted to find out where localtime
in /bin/date
is coming from:
LD_DEBUG=bindings ldd -r /bin/date 2>&1 | grep localtime
26322: binding file /bin/date [0] to /lib/libc.so.6 [0]: normal symbol `localtime' [GLIBC_2.2.5]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With