BSD Library Functions Manual
SYNOPSIS
#include <execinfo.h>
int
backtrace(void** array, int size);
char**
backtrace_symbols(void* const* array, int size);
void
backtrace_symbols_fd(void* const* array, int size, int fd);
void
backtrace_image_offsets(void* const* array, struct image_offset *image_offsets, int size);
int
backtrace_from_fp(void* startfp, void** array, int size);
DESCRIPTION
These routines provide a mechanism to examine the current thread's call stack.
backtrace() writes the function return addresses of the current call stack to the array of pointers referenced by array. At most, size pointers are writ-
ten. The number of pointers actually written to array is returned.
backtrace_symbols() attempts to transform a call stack obtained by backtrace() into an array of human-readable strings using dladdr(). The array of strings
returned has size elements. It is allocated using malloc() and should be released using free(). There is no need to free the individual strings in the
array.
backtrace_symbols_fd() performs the same operation as backtrace_symbols(), but the resulting strings are immediately written to the file descriptor fd, and
are not returned.
backtrace_image_offsets() attempts to transform a call stack obtained by backtrace() into an array of image offsets, for deferred symbolication. Each entry
in the array has an offset relative to the __TEXT section of the image with the given UUID. The results are written to image_offsets which should be an
array of size length.
backtrace_from_fp() takes a backtrace of frames starting from the given frame pointer.