How to get non-dynamic symbols in GCC backtrace?
GCC's 开发者_运维百科backtrace_symbols()
only resolves dynamic symbols, since handling all types of symbols is something GCC maintainers do not want to get into.
How would I go about extracting non-dynamic symbols obtained from GCC's backtrace()
function myself?
Check out what addr2line
does using bfd. That is one approach I have used successfully.
More specifically, backtracefilt gets you basically all the way there, you just need to adapt it to take the addresses from backtrace instead of parsing a file.
libdw
, part of elfutils, can be used to read the DWARF debugging information that is present if you compiled with -g
.
精彩评论