1UNW_GET_PROC_NAME(3)         Programming Library          UNW_GET_PROC_NAME(3)
2
3
4

NAME

6       unw_get_proc_name -- get name of current procedure
7

SYNOPSIS

9       #include <libunwind.h>
10
11       int   unw_get_proc_name(unw_cursor_t   *cp,  char  *bufp,  size_t  len,
12       unw_word_t *offp);
13

DESCRIPTION

15       The unw_get_proc_name() routine returns the name of the procedure  that
16       created  the  stack frame identified by argument cp.  The bufp argument
17       is a pointer to a character buffer that is at  least  len  bytes  long.
18       This buffer is used to return the name of the procedure. The offp argu‐
19       ment is a pointer to a word that is used to return the  byte-offset  of
20       the instruction-pointer saved in the stack frame identified by cp, rel‐
21       ative to the start of the procedure. For example,  if  procedure  foo()
22       starts  at  address  0x40003000, then invoking unw_get_proc_name() on a
23       stack frame with  an  instruction-pointer  value  of  0x40003080  would
24       return  a  value  of  0x80 in the word pointed to by offp (assuming the
25       procedure is at least 0x80 bytes long).
26
27       Note that on some platforms there is no  reliable  way  to  distinguish
28       between  procedure  names  and  ordinary labels. Furthermore, if symbol
29       information has been stripped from a program, procedure  names  may  be
30       completely  unavailable  or  may  be  limited  to  those exported via a
31       dynamic symbol table. In such cases, unw_get_proc_name() may return the
32       name  of a label or a preceeding (nearby) procedure.  However, the off‐
33       set returned through offp is always  relative  to  the  returned  name,
34       which  ensures  that  the value (address) of the returned name plus the
35       returned offset will always be equal to the instruction-pointer of  the
36       stack frame identified by cp.
37

RETURN VALUE

39       On successful completion, unw_get_proc_name() returns 0.  Otherwise the
40       negative value of one of the error-codes below is returned.
41

THREAD AND SIGNAL SAFETY

43       unw_get_proc_name() is thread-safe.  If  cursor  cp  is  in  the  local
44       address-space, this routine is also safe to use from a signal handler.
45

ERRORS

47       UNW_EUNSPEC
48               An unspecified error occurred.
49
50       UNW_ENOINFO
51               Libunwind was unable to determine the name of the procedure.
52
53       UNW_ENOMEM
54               The procedure name is too long to fit in the buffer provided. A
55              truncated version of the name has been returned.
56
57       In addition, unw_get_proc_name() may return any error returned  by  the
58       access_mem() call-back (see unw_create_addr_space(3)).
59

SEE ALSO

61       libunwind(3), unw_get_proc_info(3)
62

AUTHOR

64       David Mosberger-Tang
65       Email: dmosberger@gmail.com
66       WWW: http://www.nongnu.org/libunwind/.
67
68
69
70Programming Library             16 August 2007            UNW_GET_PROC_NAME(3)
Impressum