How to make backtrace()/backtrace_symbols() print the function names?

后端 未结 5 1877
别那么骄傲
别那么骄傲 2020-11-29 16:57

The Linux specific backtrace() and backtrace_symbols() allows you to produce a call trace of the program. However, it only prints function addresse

5条回答
  •  北海茫月
    2020-11-29 17:20

    The excellent Libbacktrace by Ian Lance Taylor solves this issue. It handles stack unwinding and supports both ordinary ELF symbols and DWARF debugging symbols.

    Libbacktrace does not require exporting all symbols, which would be ugly, and ASLR does not break it.

    Libbacktrace was originally part of the GCC distribution. Now, a standalone version can be found on Github:

    https://github.com/ianlancetaylor/libbacktrace

提交回复
热议问题