How to know which file a specific function is in with gdb?
Anyone knows how to know开发者_如何学运维 which file a specific function is in with gdb?
there is also info func which accepts a regular expression.
(gdb) info func ^bp1$
All functions matching regular expression "^bp1$":
File test.c:
void bp1();
Assuming the function name is someFunc
, first find the address of the function:
info address someFunc
And assuming you got the adress someAddress
, use list
with that address:
list *someAddress
Example from a gdb session:
(gdb) info address main
Symbol "main" is a function at address 0x406159.
(gdb) list *0x406159
0x406159 is in main (../src/staapp-test.cpp:221).
精彩评论