unw_get_proc_name.tex 3.0 KB

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