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