1 \documentclass{article}
2 \usepackage[fancyhdr,pdf]{latex2man}
8 \begin{Name}{3}{unw\_init\_local}{David Mosberger-Tang}{Programming Library}{unw\_init\_local}unw\_init\_local -- initialize cursor for local unwinding
13 \File{\#include $<$libunwind.h$>$}\\
15 \Type{int} \Func{unw\_init\_local}(\Type{unw\_cursor\_t~*}\Var{c}, \Type{unw\_context\_t~*}\Var{ctxt});\\
16 \Type{int} \Func{unw\_init\_local2}(\Type{unw\_cursor\_t~*}\Var{c}, \Type{unw\_context\_t~*}\Var{ctxt}, \Type{int} \Var{flag});\\
20 The \Func{unw\_init\_local}() routine initializes the unwind cursor
21 pointed to by \Var{c} with the machine-state in the context structure
22 pointed to by \Var{ctxt}. As such, the machine-state pointed to by
23 \Var{ctxt} identifies the initial stack frame at which unwinding
24 starts. The machine-state is expected to be one provided by a call to
25 unw_getcontext; as such, the instruction pointer may point to the
26 instruction after the last instruction of a function, and libunwind
27 will back-up the instruction pointer before beginning a walk up the
28 call stack. The machine-state must remain valid for the duration for
29 which the cursor \Var{c} is in use.
31 The \Func{unw\_init\_local}() routine can be used only for unwinding in
32 the address space of the current process (i.e., for local unwinding).
33 For all other cases, \Func{unw\_init\_remote}() must be used instead.
34 However, unwind performance may be better when using
35 \Func{unw\_init\_local}(). Also, \Func{unw\_init\_local}() is
36 available even when \Const{UNW\_LOCAL\_ONLY} has been defined before
37 including \File{$<$libunwind.h$>$}, whereas \Func{unw\_init\_remote}()
40 If the unw_context_t is known to be a signal frame (i.e., from the
41 third argument in a sigaction handler on linux),
42 \Func{unw\_init\_local2}() should be used for correct initialization
43 on some platforms, passing the UNW_INIT_SIGNAL_FRAME flag.
45 \section{Return Value}
47 On successful completion, \Func{unw\_init\_local}() returns 0.
48 Otherwise the negative value of one of the error-codes below is
51 \section{Thread and Signal Safety}
53 \Func{unw\_init\_local}() is thread-safe as well as safe to use from a
59 \item[\Const{UNW\_EINVAL}] \Func{unw\_init\_local}() was called in a
60 version of \Prog{libunwind} which supports remote unwinding only
61 (this normally happens when calling \Func{unw\_init\_local}() for a
62 cross-platform version of \Prog{libunwind}).
63 \item[\Const{UNW\_EUNSPEC}] An unspecified error occurred.
64 \item[\Const{UNW\_EBADREG}] A register needed by \Func{unw\_init\_local}()
70 \SeeAlso{libunwind(3)}, \SeeAlso{unw\_init\_remote(3)}
75 David Mosberger-Tang\\
76 Email: \Email{dmosberger@gmail.com}\\
77 WWW: \URL{http://www.nongnu.org/libunwind/}.