summaryrefslogtreecommitdiff
path: root/src/third_party/unwind/dist/doc/libunwind-setjmp.man
blob: 1faa38e475ddbaa76de6d73ff059279bbafc3b37 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
'\" t
.\" Manual page created with latex2man on Thu Aug 16 09:44:44 MDT 2007
.\" NOTE: This file is generated, DO NOT EDIT.
.de Vb
.ft CW
.nf
..
.de Ve
.ft R

.fi
..
.TH "LIBUNWIND\-SETJMP" "3" "16 August 2007" "Programming Library " "Programming Library "
.SH NAME
libunwind\-setjmp
\-\- libunwind\-based non\-local gotos 
.PP
.SH SYNOPSIS

.PP
#include <setjmp.h>
.br
.PP
int
setjmp(jmp_buf env);
.br
void
longjmp(jmp_buf env,
int val);
.br
int
_setjmp(jmp_buf env);
.br
void
_longjmp(jmp_buf env,
int val);
.br
int
sigsetjmp(sigjmp_buf env,
int savemask);
.br
void
siglongjmp(sigjmp_buf env,
int val);
.br
.PP
.SH DESCRIPTION

.PP
The unwind\-setjmp
library offers a libunwind\-based
implementation of non\-local gotos. This implementation is intended to 
be a drop\-in replacement for the normal, system\-provided routines of 
the same name. The main advantage of using the unwind\-setjmp
library is that setting up a non\-local goto via one of the 
setjmp()
routines is very fast. Typically, just 2 or 3 words 
need to be saved in the jump\-buffer (plus one call to 
sigprocmask(2),
in the case of sigsetjmp).
On the 
other hand, executing a non\-local goto by calling one of the 
longjmp()
routines tends to be much slower than with the 
system\-provided routines. In fact, the time spent on a 
longjmp()
will be proportional to the number of call frames 
that exist between the points where setjmp()
and 
longjmp()
were called. For this reason, the 
unwind\-setjmp
library is beneficial primarily in applications 
that frequently call setjmp()
but only rarely call 
longjmp().
.PP
.SH CAVEATS

.PP
.TP
.B *
The correct operation of this library depends on the presence of 
correct unwind information. On newer platforms, this is rarely an 
issue. On older platforms, care needs to be taken to 
ensure that each of the functions whose stack frames may have to be 
unwound during a longjmp()
have correct unwind information 
(on those platforms, there is usually a compiler\-switch, such as 
\fB\-funwind\-tables\fP,
to request the generation of unwind 
information). 
.TP
.B *
The contents of jmp_buf and sigjmp_buf as setup
and used by these routines is completely different from the ones 
used by the system\-provided routines. Thus, a jump\-buffer created 
by the libunwind\-based setjmp()/_setjmp
may only be 
used in a call to the libunwind\-based 
longjmp()/_longjmp().
The analogous applies for 
sigjmp_buf
with sigsetjmp()
and siglongjmp().
.PP
.SH FILES

.PP
.TP
\fB\-l\fPunwind\-setjmp
 The library an application should 
be linked against to ensure it uses the libunwind\-based non\-local 
goto routines. 
.PP
.SH SEE ALSO

.PP
libunwind(3),
setjmp(3), longjmp(3), 
_setjmp(3), _longjmp(3), 
sigsetjmp(3), siglongjmp(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.