\documentclass{article}
\usepackage[fancyhdr,pdf]{latex2man}

\input{common.tex}

\begin{document}

\begin{Name}{3libunwind}{unw\_get\_elf\_filename}{Xiang Lin}{Programming Library}{unw\_get\_elf\_filename}unw\_get\_elf\_filename -- get backing elf filename
\end{Name}

\section{Synopsis}

\File{\#include $<$libunwind.h$>$}\\

\Type{int} \Func{unw\_get\_elf\_filename}(\Type{unw\_cursor\_t~*}\Var{cp}, \Type{char~*}\Var{bufp}, \Type{size\_t} \Var{len}, \Type{unw\_word\_t~*}\Var{offp});\\

\section{Description}

The \Func{unw\_get\_elf\_filename}() routine returns the backing elf
filename of the current instruction pointer that created the stack frame
identified by argument \Var{cp}.  The \Var{bufp} argument is a pointer
to a character buffer that is at least \Var{len} bytes long.  This buffer
is used to return the name of the procedure.  The \Var{offp} argument is
a pointer to a word that is used to return the byte offset of the instruction
pointer saved in the stack frame identified by \Var{cp}, relative to the
start of the elf file. For embedded system the symbol information may has
been stripped from a program, then \Func{unw\_get\_proc\_name}() may be
completely unavailable, if the host side have the unstripped program with
debuginfo, then can use \Prog{addr2line} command tool on host to get the
source file name and line number of the instruction pointer, with the elf
filename in \Var{bufp} and address in \Var{offp}.

\section{Return Value}

On successful completion, \Func{unw\_get\_elf\_filename}() returns 0.
Otherwise the negative value of one of the error codes below is
returned.

\section{Thread and Signal Safety}

\Func{unw\_get\_elf\_filename}() is thread safe.  If cursor \Var{cp} is
in the local address space, this routine is also safe to use from a
signal handler.

\section{Errors}

\begin{Description}
\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred.
\item[\Const{UNW\_ENOINFO}] \Prog{Libunwind} was unable to determine
  the elf filename of the instruction pointer.
\item[\Const{UNW\_ENOMEM}] The elf filename is too long to fit
  in the buffer provided.  A truncated version of the name has been
  returned.
\end{Description}

\section{See Also}

\SeeAlso{libunwind}(3libunwind),
\SeeAlso{unw\_get\_proc\_info}(3libunwind)
\SeeAlso{unw\_get\_proc\_name}(3libunwind)
\SeeAlso{unw\_get\_elf\_filename\_by\_ip}(3libunwind)
\SeeAlso{addr2line}(1addr2line)

\section{Author}

\noindent
Xiang Lin\\
Email: \Email{myd.xia@gmail.com}\\
\LatexManEnd

\end{document}
