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  re‐
24       turn  a value of 0x80 in the word pointed to by offp (assuming the pro‐
25       cedure is at least 0x80 bytes long).
26
27       Note that on some platforms there is no reliable way to distinguish be‐
28       tween  procedure  names and ordinary labels. Furthermore, if symbol in‐
29       formation has been stripped from a program, procedure names may be com‐
30       pletely  unavailable  or may be limited to those exported via a dynamic
31       symbol table. In such cases, unw_get_proc_name() may return the name of
32       a  label  or  a preceeding (nearby) procedure.  However, the offset re‐
33       turned through offp is always relative to the returned name, which  en‐
34       sures  that  the value (address) of the returned name plus the returned
35       offset will always be equal to the  instruction-pointer  of  the  stack
36       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  ad‐
44       dress-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            30 November 2021           UNW_GET_PROC_NAME(3)
Impressum