mostang.com!davidm | 824d661 | 2003-02-08 10:10:59 +0000 | [diff] [blame] | 1 | \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 | |
| 21 | The \Func{unw\_resume}() routine resumes execution at the stack frame |
hp.com!davidm | a126d45 | 2003-02-22 03:08:22 +0000 | [diff] [blame] | 22 | identified by \Var{cursor}. The behavior of this routine differs |
| 23 | slightly for local and remote unwinding. |
| 24 | |
| 25 | For local unwinding, \Func{unw\_resume}() restores the machine state |
| 26 | and then directly resumes execution in the target stack frame. Thus |
| 27 | \Func{unw\_resume}() does not return in this case. Restoring the |
| 28 | machine state normally involves restoring the ``preserved'' |
| 29 | (callee-saved) registers. However, if execution in any of the stack |
| 30 | frames younger (more deeply nested) than the one identified by |
| 31 | \Var{cursor} was interrupted by a signal, then \Func{unw\_resume}() |
mostang.com!davidm | e2561af | 2003-03-06 06:14:36 +0000 | [diff] [blame^] | 32 | will restore all registers as well as the signal mask. Attempting to |
| 33 | call \Func{unw\_resume}() on a cursor which identifies the stack frame |
| 34 | of another thread results in undefined behavior (e.g., the program may |
| 35 | crash). |
hp.com!davidm | a126d45 | 2003-02-22 03:08:22 +0000 | [diff] [blame] | 36 | |
| 37 | For remote unwinding, \Func{unw\_resume}() installs the machine state |
| 38 | identified by the cursor by calling the \Func{access\_reg} and |
| 39 | \Func{access\_fpreg} accessor callbacks as needed. Once that is |
| 40 | accomplished, the \Func{resume} accessor callback is invoked. The |
| 41 | \Func{unw\_resume} routine then returns normally (that is, unlikely |
| 42 | for local unwinding, \Func{unw\_resume} will always return for remote |
| 43 | unwinding). |
mostang.com!davidm | 824d661 | 2003-02-08 10:10:59 +0000 | [diff] [blame] | 44 | |
| 45 | Most platforms reserve some registers to pass arguments to exception |
| 46 | handlers (e.g., IA-64 uses \texttt{r15}-\texttt{r18} for this |
| 47 | purpose). These registers are normally treated like ``scratch'' |
hp.com!davidm | a126d45 | 2003-02-22 03:08:22 +0000 | [diff] [blame] | 48 | registers. However, if \Prog{libunwind} is used to set an exception |
| 49 | argument register to a particular value (e.g., via |
| 50 | \Func{unw\_set\_reg}()), then \Func{unw\_resume}() will install this |
| 51 | value as the contents of the register. In other words, the exception |
| 52 | handling arguments are installed even in cases where normally only the |
mostang.com!davidm | 824d661 | 2003-02-08 10:10:59 +0000 | [diff] [blame] | 53 | ``preserved'' registers are restored. |
| 54 | |
mostang.com!davidm | 88c6bcd | 2003-02-21 07:36:26 +0000 | [diff] [blame] | 55 | Note that \Func{unw\_resume}() does \emph{not} invoke any unwind |
| 56 | handlers (aka, ``personality routines''). If a program needs this, it |
| 57 | will have to do so on its own by obtaining the \Type{unw\_proc\_info\_t} |
| 58 | of each unwound frame and appropriately processing its unwind handler |
| 59 | and language-specific data area (lsda). These steps are generally |
| 60 | dependent on the target-platform and are regulated by the |
| 61 | processor-specific ABI (application-binary interface). |
| 62 | |
mostang.com!davidm | 824d661 | 2003-02-08 10:10:59 +0000 | [diff] [blame] | 63 | \section{Return Value} |
| 64 | |
| 65 | For local unwinding, \Func{unw\_resume}() does not return on success. |
| 66 | For remote unwinding, it returns 0 on success. On failure, the |
| 67 | negative 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)}, |
| 85 | sigprocmask(2) |
| 86 | |
| 87 | \section{Author} |
| 88 | |
| 89 | \noindent |
| 90 | David Mosberger-Tang\\ |
| 91 | Hewlett-Packard Labs\\ |
| 92 | Palo-Alto, CA 94304\\ |
| 93 | Email: \Email{davidm@hpl.hp.com}\\ |
| 94 | WWW: \URL{http://www.hpl.hp.com/research/linux/libunwind/}. |
| 95 | \LatexManEnd |
| 96 | |
| 97 | \end{document} |