summaryrefslogtreecommitdiff
path: root/doc/unw_backtrace.man
blob: 91a693ab09f9f28b085e75b09478b932597d24d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
.\" *********************************** start of \input{common.tex}
.\" *********************************** end of \input{common.tex}
'\" t
.\" Manual page created with latex2man on Thu Dec  8 12:01:30 2022
.\" NOTE: This file is generated, DO NOT EDIT.
.de Vb
.ft CW
.nf
..
.de Ve
.ft R

.fi
..
.TH "UNW\\_BACKTRACE" "3" "08 December 2022" "Programming Library " "Programming Library "
.SH NAME
unw_backtrace
\-\- return backtrace for the calling program 
.PP
.SH SYNOPSIS

.PP
#include <libunwind.h>
.br
.PP
int
unw_backtrace(void **buffer,
int size);
.br
int
unw_backtrace2(void **buffer,
int size,
unw_context_t *ctxt);
.br
.PP
#include <execinfo.h>
.br
.PP
int
backtrace(void **buffer,
int size);
.br
.PP
.SH DESCRIPTION

.PP
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. 
.PP
Note that many (but not all) systems provide a 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().
.PP
If the unw_context_t
is known to be a signal frame (i.e., from the third argument 
in a sigaction handler on linux), unw_backtrace2
can be used to collect 
only the frames before the signal frame. 
.PP
.SH RETURN VALUE

.PP
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. 
.PP
.SH SEE ALSO

.PP
libunwind(3),
unw_step(3)
.PP
.SH AUTHOR

.PP
David Mosberger\-Tang
.br
Email: \fBdmosberger@gmail.com\fP
.br
WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
.\" NOTE: This file is generated, DO NOT EDIT.