unw_init_local.tex 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. \documentclass{article}
  2. \usepackage[fancyhdr,pdf]{latex2man}
  3. \input{common.tex}
  4. \begin{document}
  5. \begin{Name}{3}{unw\_init\_local}{David Mosberger-Tang}{Programming Library}{unw\_init\_local}unw\_init\_local -- initialize cursor for local unwinding
  6. \end{Name}
  7. \section{Synopsis}
  8. \File{\#include $<$libunwind.h$>$}\\
  9. \Type{int} \Func{unw\_init\_local}(\Type{unw\_cursor\_t~*}\Var{c}, \Type{unw\_context\_t~*}\Var{ctxt});\\
  10. \section{Description}
  11. The \Func{unw\_init\_local}() routine initializes the unwind cursor
  12. pointed to by \Var{c} with the machine-state in the context structure
  13. pointed to by \Var{ctxt}. As such, the machine-state pointed to by
  14. \Var{ctxt} identifies the initial stack frame at which unwinding
  15. starts. The machine-state must remain valid for the duration for
  16. which the cursor \Var{c} is in use.
  17. The \Func{unw\_init\_local}() routine can be used only for unwinding in
  18. the address space of the current process (i.e., for local unwinding).
  19. For all other cases, \Func{unw\_init\_remote}() must be used instead.
  20. From a behavioral point of view, the call:
  21. \begin{verbatim}
  22. ret = unw_init_local(&cursor, &ucontext);
  23. \end{verbatim}
  24. is equivalent to:
  25. \begin{verbatim}
  26. ret = unw_init_remote(&cursor, unw_local_addr_space,
  27. &ucontext);
  28. \end{verbatim}
  29. However, unwind performance may be better when using
  30. \Func{unw\_init\_local}(). Also, \Func{unw\_init\_local}() is
  31. available even when \Const{UNW\_LOCAL\_ONLY} has been defined before
  32. including \File{$<$libunwind.h$>$}, whereas \Func{unw\_init\_remote}()
  33. is not.
  34. \section{Return Value}
  35. On successful completion, \Func{unw\_init\_local}() returns 0.
  36. Otherwise the negative value of one of the error-codes below is
  37. returned.
  38. \section{Thread and Signal Safety}
  39. \Func{unw\_init\_local}() is thread-safe as well as safe to use from a
  40. signal handler.
  41. \section{Errors}
  42. \begin{Description}
  43. \item[\Const{UNW\_EINVAL}] \Func{unw\_init\_local}() was called in a
  44. version of \Prog{libunwind} which supports remote unwinding only
  45. (this normally happens when calling \Func{unw\_init\_local}() for a
  46. cross-platform version of \Prog{libunwind}).
  47. \item[\Const{UNW\_EUNSPEC}] An unspecified error occurred.
  48. \item[\Const{UNW\_EBADREG}] A register needed by \Func{unw\_init\_local}()
  49. wasn't accessible.
  50. \end{Description}
  51. \section{See Also}
  52. \SeeAlso{libunwind(3)}, \SeeAlso{unw\_init\_remote(3)}
  53. \section{Author}
  54. \noindent
  55. David Mosberger-Tang\\
  56. Email: \Email{dmosberger@gmail.com}\\
  57. WWW: \URL{http://www.nongnu.org/libunwind/}.
  58. \LatexManEnd
  59. \end{document}