Home | History | Annotate | Download | only in doc
      1 \documentclass{article}
      2 \usepackage[fancyhdr,pdf]{latex2man}
      3 
      4 \input{common.tex}
      5 
      6 \begin{document}
      7 
      8 \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
      9 \end{Name}
     10 
     11 \section{Synopsis}
     12 
     13 \File{\#include $<$libunwind.h$>$}\\
     14 
     15 \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});\\
     16 
     17 \section{Description}
     18 
     19 The \Func{unw\_get\_proc\_name}() routine returns the name of the
     20 procedure that created the stack frame identified by argument
     21 \Var{cp}.  The \Var{bufp} argument is a pointer to a character buffer
     22 that is at least \Var{len} bytes long.  This buffer is used to return
     23 the name of the procedure.  The \Var{offp} argument is a pointer to a
     24 word that is used to return the byte-offset of the instruction-pointer
     25 saved in the stack frame identified by \Var{cp}, relative to the start
     26 of the procedure.  For example, if procedure \Func{foo}() starts at
     27 address 0x40003000, then invoking \Func{unw\_get\_proc\_name}() on a
     28 stack frame with an instruction-pointer value of 0x40003080 would
     29 return a value of 0x80 in the word pointed to by \Var{offp} (assuming
     30 the procedure is at least 0x80 bytes long).
     31 
     32 Note that on some platforms there is no reliable way to distinguish
     33 between procedure names and ordinary labels.  Furthermore, if symbol
     34 information has been stripped from a program, procedure names may be
     35 completely unavailable or may be limited to those exported via a
     36 dynamic symbol table.  In such cases, \Func{unw\_get\_proc\_name}()
     37 may return the name of a label or a preceeding (nearby) procedure.
     38 However, the offset returned through \Var{offp} is always relative to
     39 the returned name, which ensures that the value (address) of the
     40 returned name plus the returned offset will always be equal to the
     41 instruction-pointer of the stack frame identified by \Var{cp}.
     42 
     43 \section{Return Value}
     44 
     45 On successful completion, \Func{unw\_get\_proc\_name}() returns 0.
     46 Otherwise the negative value of one of the error-codes below is
     47 returned.
     48 
     49 \section{Thread and Signal Safety}
     50 
     51 \Func{unw\_get\_proc\_name}() is thread-safe.  If cursor \Var{cp} is
     52 in the local address-space, this routine is also safe to use from a
     53 signal handler.
     54 
     55 \section{Errors}
     56 
     57 \begin{Description}
     58 \item[\Const{UNW\_EUNSPEC}] An unspecified error occurred.
     59 \item[\Const{UNW\_ENOINFO}] \Prog{Libunwind} was unable to determine
     60   the name of the procedure.
     61 \item[\Const{UNW\_ENOMEM}] The procedure name is too long to fit
     62   in the buffer provided.  A truncated version of the name has been
     63   returned.
     64 \end{Description}
     65 In addition, \Func{unw\_get\_proc\_name}() may return any error
     66 returned by the \Func{access\_mem}() call-back (see
     67 \Func{unw\_create\_addr\_space}(3)).
     68 
     69 \section{See Also}
     70 
     71 \SeeAlso{libunwind(3)},
     72 \SeeAlso{unw\_get\_proc\_info(3)}
     73 
     74 \section{Author}
     75 
     76 \noindent
     77 David Mosberger-Tang\\
     78 Email: \Email{dmosberger (a] gmail.com}\\
     79 WWW: \URL{http://www.nongnu.org/libunwind/}.
     80 \LatexManEnd
     81 
     82 \end{document}
     83