blob: 68d740efa86efeb6dd796bd19a883ebd7e311b7b [file] [log] [blame]
mostang.com!davidm824d6612003-02-08 10:10:59 +00001\documentclass{article}
2\usepackage[fancyhdr,pdf]{latex2man}
3
4\input{common.tex}
5
6\begin{document}
7
esiee.fr!m.delahaye972aec72003-03-31 19:57:09 +00008\begin{Name}{3}{unw\_resume}{David Mosberger-Tang}{Programming Library}{unw\_resume}unw\_resume -- resume execution in a particular stack frame
mostang.com!davidm824d6612003-02-08 10:10:59 +00009\end{Name}
10
11\section{Synopsis}
12
13\File{\#include $<$libunwind.h$>$}\\
14
mostang.com!davidm1a595c42003-03-13 02:15:01 +000015\Type{int} \Func{unw\_resume}(\Type{unw\_cursor\_t~*}\Var{cp});\\
mostang.com!davidm824d6612003-02-08 10:10:59 +000016
17\section{Description}
18
19The \Func{unw\_resume}() routine resumes execution at the stack frame
mostang.com!davidm1a595c42003-03-13 02:15:01 +000020identified by \Var{cp}. The behavior of this routine differs
hp.com!davidma126d452003-02-22 03:08:22 +000021slightly for local and remote unwinding.
22
23For local unwinding, \Func{unw\_resume}() restores the machine state
24and then directly resumes execution in the target stack frame. Thus
25\Func{unw\_resume}() does not return in this case. Restoring the
26machine state normally involves restoring the ``preserved''
27(callee-saved) registers. However, if execution in any of the stack
28frames younger (more deeply nested) than the one identified by
mostang.com!davidm1a595c42003-03-13 02:15:01 +000029\Var{cp} was interrupted by a signal, then \Func{unw\_resume}() will
30restore all registers as well as the signal mask. Attempting to call
31\Func{unw\_resume}() on a cursor which identifies the stack frame of
32another thread results in undefined behavior (e.g., the program may
mostang.com!davidme2561af2003-03-06 06:14:36 +000033crash).
hp.com!davidma126d452003-02-22 03:08:22 +000034
35For remote unwinding, \Func{unw\_resume}() installs the machine state
36identified by the cursor by calling the \Func{access\_reg} and
37\Func{access\_fpreg} accessor callbacks as needed. Once that is
38accomplished, the \Func{resume} accessor callback is invoked. The
39\Func{unw\_resume} routine then returns normally (that is, unlikely
40for local unwinding, \Func{unw\_resume} will always return for remote
41unwinding).
mostang.com!davidm824d6612003-02-08 10:10:59 +000042
43Most platforms reserve some registers to pass arguments to exception
44handlers (e.g., IA-64 uses \texttt{r15}-\texttt{r18} for this
45purpose). These registers are normally treated like ``scratch''
hp.com!davidma126d452003-02-22 03:08:22 +000046registers. However, if \Prog{libunwind} is used to set an exception
47argument register to a particular value (e.g., via
48\Func{unw\_set\_reg}()), then \Func{unw\_resume}() will install this
49value as the contents of the register. In other words, the exception
50handling arguments are installed even in cases where normally only the
mostang.com!davidm824d6612003-02-08 10:10:59 +000051``preserved'' registers are restored.
52
mostang.com!davidm88c6bcd2003-02-21 07:36:26 +000053Note that \Func{unw\_resume}() does \emph{not} invoke any unwind
54handlers (aka, ``personality routines''). If a program needs this, it
55will have to do so on its own by obtaining the \Type{unw\_proc\_info\_t}
56of each unwound frame and appropriately processing its unwind handler
57and language-specific data area (lsda). These steps are generally
58dependent on the target-platform and are regulated by the
59processor-specific ABI (application-binary interface).
60
mostang.com!davidm824d6612003-02-08 10:10:59 +000061\section{Return Value}
62
63For local unwinding, \Func{unw\_resume}() does not return on success.
64For remote unwinding, it returns 0 on success. On failure, the
65negative value of one of the errors below is returned.
66
mostang.com!davidm1c48aa02003-03-11 01:05:47 +000067\section{Thread and Signal Safety}
68
69\Func{unw\_resume}() is thread-safe as well as safe to use from a
70signal handler.
71
mostang.com!davidm824d6612003-02-08 10:10:59 +000072\section{Errors}
73
74\begin{Description}
75\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred.
76\item[\Const{UNW\_EBADREG}] A register needed by \Func{unw\_resume}() wasn't
77 accessible.
78\item[\Const{UNW\_EINVALIDIP}] The instruction pointer identified by
mostang.com!davidm1a595c42003-03-13 02:15:01 +000079 \Var{cp} is not valid.
mostang.com!davidm824d6612003-02-08 10:10:59 +000080\item[\Const{UNW\_BADFRAME}] The stack frame identified by
mostang.com!davidm1a595c42003-03-13 02:15:01 +000081 \Var{cp} is not valid.
mostang.com!davidm824d6612003-02-08 10:10:59 +000082\end{Description}
83
84\section{See Also}
85
86\SeeAlso{libunwind(3)},
87\SeeAlso{unw\_set\_reg(3)},
88sigprocmask(2)
89
90\section{Author}
91
92\noindent
93David Mosberger-Tang\\
94Hewlett-Packard Labs\\
95Palo-Alto, CA 94304\\
96Email: \Email{davidm@hpl.hp.com}\\
97WWW: \URL{http://www.hpl.hp.com/research/linux/libunwind/}.
98\LatexManEnd
99
100\end{document}