2003-03-31 21:57:09 +02:00
\documentclass { article}
\usepackage [fancyhdr,pdf] { latex2man}
\input { common.tex}
\begin { document}
\begin { Name} { 3} { unw\_ get\_ proc\_ name} { David Mosberger-Tang} { Programming Library} { unw\_ get\_ proc\_ name} unw\_ get\_ proc\_ name -- get name of current procedure
\end { Name}
\section { Synopsis}
\File { \# include $ < $ libunwind.h$ > $ } \\
\Type { int} \Func { unw\_ get\_ proc\_ name} (\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\_ proc\_ name} () routine returns the name of the
procedure 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 procedure. For example, if procedure \Func { foo} () starts at
address 0x40003000, then invoking \Func { unw\_ get\_ proc\_ name} () on a
stack frame with an instruction-pointer value of 0x40003080 would
return a value of 0x80 in the word pointed to by \Var { offp} (assuming
the procedure is at least 0x80 bytes long).
Note that on some platforms there is no reliable way to distinguish
between procedure names and ordinary labels. Furthermore, if symbol
information has been stripped from a program, procedure names may be
completely unavailable or may be limited to those exported via a
dynamic symbol table. In such cases, \Func { unw\_ get\_ proc\_ name} ()
may return the name of a label or a preceeding (nearby) procedure.
However, the offset returned through \Var { offp} is always relative to
the returned name, which ensures that the value (address) of the
returned name plus the returned offset will always be equal to the
instruction-pointer of the stack frame identified by \Var { cp} .
\section { Return Value}
On successful completion, \Func { unw\_ get\_ proc\_ name} () returns 0.
Otherwise the negative value of one of the error-codes below is
returned.
\section { Thread and Signal Safety}
2004-03-31 09:42:38 +02:00
\Func { unw\_ get\_ proc\_ name} () is thread-safe. If cursor \Var { cp} is
in the local address-space, this routine is also safe to use from a
signal handler.
2003-03-31 21:57:09 +02:00
\section { Errors}
\begin { Description}
\item [\Const{UNW\_EUNSPEC}] An unspecified error occurred.
\item [\Const{UNW\_ENOINFO}] \Prog { Libunwind} was unable to determine
the name of the procedure.
\item [\Const{UNW\_ENOMME}] The procedure name is too long to fit
in the buffer provided. A truncated version of the name has been
returned.
\end { Description}
In addition, \Func { unw\_ get\_ proc\_ name} () may return any error
returned by the \Func { access\_ mem} () call-back (see
\Func { unw\_ create\_ addr\_ space} (3)).
\section { See Also}
\SeeAlso { libunwind(3)} ,
\SeeAlso { unw\_ get\_ proc\_ info(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}