We can set breakpoint at a func, hence gdb knows the entrance and exit address of a certain function. But how does it get this information? Does it uses DWARF or readelf for the executable, if yes, how? Thanks
A:
GDB uses multiple "signals":
- It reads the symbol table.
- It may apply heuristics to skip past function prolog (usually you don't want to stop in a function prolog, as call parameters may not have yet been set up, and will look "funny" if printed).
- If
available, it also reads debug info
(which could be
DWARF
,STABS
, or something else depending on the platform and the compiler).
Generally GDB will not call into "external" readelf
executable -- it contains all the smarts to read the info directly.
If you want to know exactly how this is done, read the source.
Employed Russian
2010-10-19 05:26:27