1UNW_BACKTRACE(3) Programming Library UNW_BACKTRACE(3)
2
3
4
6 unw_backtrace -- return backtrace for the calling program
7
9 #include <libunwind.h>
10
11 int unw_backtrace(void **buffer, int size);
12
13 #include <execinfo.h>
14
15 int backtrace(void **buffer, int size);
16
18 unw_backtrace() is a convenient routine for obtaining the backtrace for
19 the calling program. The routine fills up to size addresses in the
20 array pointed by buffer. The routine is only available for local
21 unwinding.
22
23 Note that many (but not all) systems provide practically identical
24 function called backtrace(). The prototype for this function is usu‐
25 ally obtained by including the <execinfo.h> header file -- a prototype
26 for backtrace() is not provided by libunwind. libunwind weakly aliases
27 backtrace() to unw_backtrace(), so when a program calling backtrace()
28 is linked against libunwind, it may end up calling unw_backtrace().
29
31 The routine returns the number of addresses stored in the array pointed
32 by buffer. The return value may be zero to indicate that no addresses
33 were stored.
34
36 libunwind(3), unw_step(3)
37
39 David Mosberger-Tang
40 Email: dmosberger@gmail.com
41 WWW: http://www.nongnu.org/libunwind/.
42
43
44
45Programming Library 31 August 2012 UNW_BACKTRACE(3)