Main index | Section 3 | Options |
#include <execinfo.h>
The backtrace_symbols_fmt() function takes an array of previously filled addresses from backtrace() in addrlist of len elements, and uses fmt to format them. The formatting characters available are:
a | The numeric address of each element as would be printed using %p. |
n | The name of the nearest function symbol (smaller than the address element) as determined by dladdr(3) if the symbol was dynamic, or looked up in the executable if static and the /proc filesystem is available to determine the executable path. |
d | The difference of the symbol address and the address element printed using 0x%tx. |
D | The difference of the symbol address and the address element printed using +0x%tx if non-zero, or nothing if zero. |
f | The filename of the symbol as determined by dladdr(3). |
The array of formatted strings is returned as a contiguous memory address which can be freed by a single free(3).
The backtrace_symbols() function is equivalent of calling backtrace_symbols_fmt() with a format argument of %a <%n%D> at %f
The backtrace_symbols_fd() and backtrace_symbols_fd_fmt() are similar to the non _fd named functions, only instead of returning an array or strings, they print a new-line separated array of strings in fd, and return 0 on success and -1 on failure.
BACKTRACE (3) | December 12, 2015 |
Main index | Section 3 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
“ | The number of UNIX installations has grown to 10, with more expected. | ” |
— UNIX Programming Manual, 1972 |