Files
libunwind/doc/unw_backtrace.tex
Stephen Webb e1964a6a2c Move man pages into section 3libunwind
It's a convention that unadorned section 3 man pages are libc functions
and other libraries adorn the section name.

Also added example code to the ptrace and nto remotes and fixed some
unusual Engish-language constructs.

Regenerated all man pages from their LaTEX sources.
2023-09-07 11:20:20 -04:00

62 lines
2.2 KiB
TeX

\documentclass{article}
\usepackage[fancyhdr,pdf]{latex2man}
\input{common.tex}
\begin{document}
\begin{Name}{3libunwind}{unw\_backtrace}{David Mosberger-Tang}{Programming Library}{unw\_backtrace}unw\_backtrace -- return backtrace for the calling program
\end{Name}
\section{Synopsis}
\File{\#include $<$libunwind.h$>$}\\
\Type{int} \Func{unw\_backtrace}(\Type{void~**}\Var{buffer}, \Type{int}~\Var{size});\\
\Type{int} \Func{unw\_backtrace2}(\Type{void~**}\Var{buffer}, \Type{int}~\Var{size}, \Type{unw_context_t~*}\Var{ctxt}, \Type{int}~\Var{flag});\\
\File{\#include $<$execinfo.h$>$}\\
\Type{int} \Func{backtrace}(\Type{void~**}\Var{buffer}, \Type{int}~\Var{size});\\
\section{Description}
\Func{unw\_backtrace}() is a convenient routine for obtaining the backtrace for
the calling program. The routine fills up to \Var{size} addresses in the array
pointed by \Var{buffer}. The routine is only available for local unwinding.
Note that many (but not all) systems provide a practically identical function
called \Func{backtrace}(). The prototype for this function is usually obtained
by including the \File{$<$execinfo.h$>$} header file -- a prototype for
\Func{backtrace}() is not provided by \Prog{libunwind}. \Prog{libunwind} weakly
aliases \Func{backtrace}() to \Func{unw\_backtrace}(), so when a program
calling \Func{backtrace}() is linked against \Prog{libunwind}, it may end up
calling \Func{unw\_backtrace}().
In case you want to obtain the backtrace from a specific \Type{unw\_context\_t},
you can call \Func{unw\_backtrace2} with that context passing \Const{0} for flag.
If the \Type{unw\_context\_t} is known to be a signal frame (i.e., from the third argument
in a sigaction handler on linux), \Func{unw\_backtrace2} can be used to collect
only the frames before the signal frame passing the \Const{UNW\_INIT\_SIGNAL\_FRAME} flag.
\section{Return Value}
The routine returns the number of addresses stored in the array pointed by
\Var{buffer}. The return value may be zero to indicate that no addresses were
stored.
\section{See Also}
\SeeAlso{libunwind}(3libunwind),
\SeeAlso{unw\_step}(3libunwind)
\section{Author}
\noindent
David Mosberger-Tang\\
Email: \Email{dmosberger@gmail.com}\\
WWW: \URL{http://www.nongnu.org/libunwind/}.
\LatexManEnd
\end{document}