unw_backtrace man page
unw_backtrace -- return backtrace for the calling program
int unw_backtrace(void **buffer, int size);
int backtrace(void **buffer, int size);
unw_backtrace() is a convenient routine for obtaining the backtrace for the calling program. The routine fills up to size addresses in the array pointed by buffer. The routine is only available for local unwinding.
Note that many (but not all) systems provide practically identical function called backtrace(). The prototype for this function is usually obtained by including the <execinfo.h> header file -- a prototype for backtrace() is not provided by libunwind. libunwind weakly aliases backtrace() to unw_backtrace(), so when a program calling backtrace() is linked against libunwind, it may end up calling unw_backtrace().
The routine returns the number of addresses stored in the array pointed by buffer. The return value may be zero to indicate that no addresses were stored.