unw_resume.tex 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. \documentclass{article}
  2. \usepackage[fancyhdr,pdf]{latex2man}
  3. \input{common.tex}
  4. \begin{document}
  5. \begin{Name}{3}{unw\_resume}{David Mosberger-Tang}{Programming Library}{unw\_resume}unw\_resume -- resume execution in a particular stack frame
  6. \end{Name}
  7. \section{Synopsis}
  8. \File{\#include $<$libunwind.h$>$}\\
  9. \Type{int} \Func{unw\_resume}(\Type{unw\_cursor\_t~*}\Var{cp});\\
  10. \section{Description}
  11. The \Func{unw\_resume}() routine resumes execution at the stack frame
  12. identified by \Var{cp}. The behavior of this routine differs
  13. slightly for local and remote unwinding.
  14. For local unwinding, \Func{unw\_resume}() restores the machine state
  15. and then directly resumes execution in the target stack frame. Thus
  16. \Func{unw\_resume}() does not return in this case. Restoring the
  17. machine state normally involves restoring the ``preserved''
  18. (callee-saved) registers. However, if execution in any of the stack
  19. frames younger (more deeply nested) than the one identified by
  20. \Var{cp} was interrupted by a signal, then \Func{unw\_resume}() will
  21. restore all registers as well as the signal mask. Attempting to call
  22. \Func{unw\_resume}() on a cursor which identifies the stack frame of
  23. another thread results in undefined behavior (e.g., the program may
  24. crash).
  25. For remote unwinding, \Func{unw\_resume}() installs the machine state
  26. identified by the cursor by calling the \Func{access\_reg} and
  27. \Func{access\_fpreg} accessor callbacks as needed. Once that is
  28. accomplished, the \Func{resume} accessor callback is invoked. The
  29. \Func{unw\_resume} routine then returns normally (that is, unlikely
  30. for local unwinding, \Func{unw\_resume} will always return for remote
  31. unwinding).
  32. Most platforms reserve some registers to pass arguments to exception
  33. handlers (e.g., IA-64 uses \texttt{r15}-\texttt{r18} for this
  34. purpose). These registers are normally treated like ``scratch''
  35. registers. However, if \Prog{libunwind} is used to set an exception
  36. argument register to a particular value (e.g., via
  37. \Func{unw\_set\_reg}()), then \Func{unw\_resume}() will install this
  38. value as the contents of the register. In other words, the exception
  39. handling arguments are installed even in cases where normally only the
  40. ``preserved'' registers are restored.
  41. Note that \Func{unw\_resume}() does \emph{not} invoke any unwind
  42. handlers (aka, ``personality routines''). If a program needs this, it
  43. will have to do so on its own by obtaining the \Type{unw\_proc\_info\_t}
  44. of each unwound frame and appropriately processing its unwind handler
  45. and language-specific data area (lsda). These steps are generally
  46. dependent on the target-platform and are regulated by the
  47. processor-specific ABI (application-binary interface).
  48. \section{Return Value}
  49. For local unwinding, \Func{unw\_resume}() does not return on success.
  50. For remote unwinding, it returns 0 on success. On failure, the
  51. negative value of one of the errors below is returned.
  52. \section{Thread and Signal Safety}
  53. \Func{unw\_resume}() is thread-safe. If cursor \Var{cp} is in the
  54. local address-space, this routine is also safe to use from a signal
  55. handler.
  56. \section{Errors}
  57. \begin{Description}
  58. \item[\Const{UNW\_EUNSPEC}] An unspecified error occurred.
  59. \item[\Const{UNW\_EBADREG}] A register needed by \Func{unw\_resume}() wasn't
  60. accessible.
  61. \item[\Const{UNW\_EINVALIDIP}] The instruction pointer identified by
  62. \Var{cp} is not valid.
  63. \item[\Const{UNW\_BADFRAME}] The stack frame identified by
  64. \Var{cp} is not valid.
  65. \end{Description}
  66. \section{See Also}
  67. \SeeAlso{libunwind(3)},
  68. \SeeAlso{unw\_set\_reg(3)},
  69. sigprocmask(2)
  70. \section{Author}
  71. \noindent
  72. David Mosberger-Tang\\
  73. Email: \Email{dmosberger@gmail.com}\\
  74. WWW: \URL{http://www.nongnu.org/libunwind/}.
  75. \LatexManEnd
  76. \end{document}