backtrace, backtrace_symbols, backtrace_symbols_fd - support for application self-debugging
SYNOPSIS
#include <execinfo.h>
int backtrace(void **buffer, int size);
char **backtrace_symbols(void *const *buffer, int size);
void backtrace_symbols_fd(void *const *buffer, int size, int fd);
DESCRIPTION
backtrace() returns a backtrace for the calling program, in the array pointed to by buffer. A
backtrace is the series of currently active function calls for the program. Each item in the
array pointed to by buffer is of type void *, and is the return address from the corresponding
stack frame. The size argument specifies the maximum number of addresses that can be stored in
BACKTRACE(3) Linux Programmer's Manual BACKTRACE(3)
NAME
backtrace, backtrace_symbols, backtrace_symbols_fd - support for application self-debugging
SYNOPSIS
#include <execinfo.h>
int backtrace(void **buffer, int size);
char **backtrace_symbols(void *const *buffer, int size);
void backtrace_symbols_fd(void *const *buffer, int size, int fd);
DESCRIPTION
backtrace() returns a backtrace for the calling program, in the array pointed to by buffer. A
backtrace is the series of currently active function calls for the program. Each item in the
Manual page backtrace_symbols(3) line 1/163 13% (press h for help or q to quit)
should not be freed.)
backtrace_symbols_fd() takes the same buffer and size arguments as backtrace_symbols(), but
instead of returning an array of strings to the caller, it writes the strings, one per line, to
the file descriptor fd. backtrace_symbols_fd() does not call malloc(3), and so can be employed in
situations where the latter function might fail.
RETURN VALUE
backtrace() returns the number of addresses returned in buffer, which is not greater than size.
If the return value is less than size, then the full backtrace was stored; if it is equal to size,
then it may have been truncated, in which case the addresses of the oldest stack frames are not
returned.
On success, backtrace_symbols() returns a pointer to the array malloc(3)ed by the call; on error,
NULL is returned.
VERSIONS
backtrace(), backtrace_symbols(), and backtrace_symbols_fd() are provided in glibc since version
2.1.
ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7).
┌───────────────────────┬───────────────┬─────────┐
│Interface │ Attribute │ Value │
├───────────────────────┼───────────────┼─────────┤
│backtrace(), │ Thread safety │ MT-Safe │
│backtrace_symbols(), │ │ │
│backtrace_symbols_fd() │ │ │
└───────────────────────┴───────────────┴─────────┘
CONFORMING TO
These functions are GNU extensions.
Manual page backtrace_symbols(3) line 47/163 59% (press h for help or q to quit)
【无标题】backtrace_symbols
最新推荐文章于 2024-02-26 22:59:03 发布