2003-03-31 21:57:09 +02:00
\documentclass { article}
\usepackage [fancyhdr,pdf] { latex2man}
\input { common.tex}
\begin { document}
\begin { Name} { 3} { unw\_ init\_ local} { David Mosberger-Tang} { Programming Library} { unw\_ init\_ local} unw\_ init\_ local -- initialize cursor for local unwinding
\end { Name}
\section { Synopsis}
\File { \# include $ < $ libunwind.h$ > $ } \\
\Type { int} \Func { unw\_ init\_ local} (\Type { unw\_ cursor\_ t~*} \Var { c} , \Type { unw\_ context\_ t~*} \Var { ctxt} );\\
2017-08-16 21:15:16 +02:00
\Type { int} \Func { unw\_ init\_ local2} (\Type { unw\_ cursor\_ t~*} \Var { c} , \Type { unw\_ context\_ t~*} \Var { ctxt} , \Type { int} \Var { flag} );\\
2003-03-31 21:57:09 +02:00
\section { Description}
The \Func { unw\_ init\_ local} () routine initializes the unwind cursor
pointed to by \Var { c} with the machine-state in the context structure
pointed to by \Var { ctxt} . As such, the machine-state pointed to by
\Var { ctxt} identifies the initial stack frame at which unwinding
2017-03-30 23:35:35 +02:00
starts. The machine-state is expected to be one provided by a call to
unw_ getcontext; as such, the instruction pointer may point to the
instruction after the last instruction of a function, and libunwind
will back-up the instruction pointer before beginning a walk up the
call stack. The machine-state must remain valid for the duration for
2003-03-31 21:57:09 +02:00
which the cursor \Var { c} is in use.
The \Func { unw\_ init\_ local} () routine can be used only for unwinding in
the address space of the current process (i.e., for local unwinding).
For all other cases, \Func { unw\_ init\_ remote} () must be used instead.
However, unwind performance may be better when using
\Func { unw\_ init\_ local} (). Also, \Func { unw\_ init\_ local} () is
available even when \Const { UNW\_ LOCAL\_ ONLY} has been defined before
including \File { $ < $ libunwind.h$ > $ } , whereas \Func { unw\_ init\_ remote} ()
is not.
2017-03-30 23:35:35 +02:00
If the unw_ context_ t is known to be a signal frame (i.e., from the
third argument in a sigaction handler on linux),
2017-08-16 21:15:16 +02:00
\Func { unw\_ init\_ local2} () should be used for correct initialization
on some platforms, passing the UNW_ INIT_ SIGNAL_ FRAME flag.
2017-03-30 23:35:35 +02:00
2003-03-31 21:57:09 +02:00
\section { Return Value}
On successful completion, \Func { unw\_ init\_ local} () returns 0.
Otherwise the negative value of one of the error-codes below is
returned.
\section { Thread and Signal Safety}
\Func { unw\_ init\_ local} () is thread-safe as well as safe to use from a
signal handler.
\section { Errors}
\begin { Description}
\item [\Const{UNW\_EINVAL}] \Func { unw\_ init\_ local} () was called in a
version of \Prog { libunwind} which supports remote unwinding only
(this normally happens when calling \Func { unw\_ init\_ local} () for a
cross-platform version of \Prog { libunwind} ).
\item [\Const{UNW\_EUNSPEC}] An unspecified error occurred.
\item [\Const{UNW\_EBADREG}] A register needed by \Func { unw\_ init\_ local} ()
wasn't accessible.
\end { Description}
\section { See Also}
\SeeAlso { libunwind(3)} , \SeeAlso { unw\_ init\_ remote(3)}
\section { Author}
\noindent
David Mosberger-Tang\\
2007-08-22 20:49:08 +02:00
Email: \Email { dmosberger@gmail.com} \\
WWW: \URL { http://www.nongnu.org/libunwind/} .
2003-03-31 21:57:09 +02:00
\LatexManEnd
\end { document}