I am using google\'s heap checker to track down a memory leak. It gives me a stack trace such as:
Leak of 21 bytes in 1 objects allocated from:
The original question asked how to do this in GDB:
# NOT what you want; note the lack of '*':
(gdb) info symbol 0xfde09edc
blah() + 388 in section .text of /tmp/libblah.so
# IS what you want; note the presence of '*':
(gdb) info line *0xfde09edc
Line 91 of "blah.cc"
starts at address 0xfde09ebc
and ends at 0xfde09ee4
The *
is necessary for info line
and shouldn't be used for info symbol
.
You can also use the disassemble
command with its /m
flag:
(gdb) disassemble /m 0xfde09edc
... though it's rather verbose and info line
gives exactly what was requested.