---
name: "unw_get_proc_info_by_ip"
section: "3libunwind"
platform: "linux"
package: "libunwind-dev"
version: "1.8.1-0.1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/unw_get_proc_info_by_ip/3libunwind"
---

# unw\_get\_proc\_info\_by\_ip(3libunwind)

## NAME

unw\_get\_proc\_info\_by\_ip -- get procedure info by IP

## SYNOPSIS

\#include \<libunwind.h\>\

int unw\_get\_proc\_info\_by\_ip(unw\_addr\_space\_t as, unw\_word\_t ip, unw\_proc\_info\_t \*pip, void \*arg);\

## DESCRIPTION

The unw\_get\_proc\_info\_by\_ip() routine returns the same  kind of auxiliary information about a procedure as  unw\_get\_proc\_info(), except that the info is looked up by  instruction-pointer (IP) instead of a cursor. This is more flexible  because it is possible to look up the info for an arbitrary procedure,  even if it is not part of the current call chain. However, since it  is more flexible, it also tends to run slower (and often much slower)  than unw\_get\_proc\_info().

The routine expects the following arguments: as is the  address-space in which the instruction pointer should be looked up.  For a look-up in the local address-space,  unw\_local\_addr\_space can be passed for this argument.  Argument ip is the instruction-pointer for which the procedure  info should be looked up and pip is a pointer to a structure of  type unw\_proc\_info\_t which is used to return the info.  Lastly, arg is the address space argument that should be used  when accessing the address space. It has the same purpose as the  argument of the same name for unw\_init\_remote(). When  accessing the local address space (first argument is  unw\_local\_addr\_space), NULL must be passed for this  argument.

Note that for the purposes of libunwind, the code of a  procedure is assumed to occupy a single, contiguous range of  addresses. For this reason, it is always possible to describe the  extent of a procedure with the start\_ip and end\_ip members. If a single function/routine is split into multiple,  discontiguous pieces, libunwind will treat each piece as a  separate procedure.

## RETURN VALUE

On successful completion, unw\_get\_proc\_info\_by\_ip() returns 0. Otherwise the negative value of one of the error-codes  below is returned.

## THREAD AND SIGNAL SAFETY

unw\_get\_proc\_info\_by\_ip() is thread safe. If the local  address space is passed in argument as, this routine is also  safe to use from a signal handler.

## ERRORS

- UNW\_EUNSPEC

   An unspecified error occurred.

- UNW\_ENOINFO

   Libunwind was unable to locate  unwind-info for the procedure.

- UNW\_EBADVERSION

   The unwind-info for the procedure has  version or format that is not understood by libunwind.

In addition, unw\_get\_proc\_info\_by\_ip() may return any  error returned by the access\_mem() callback (see  unw\_create\_addr\_space(3libunwind)).

## SEE ALSO

libunwind(3libunwind), unw\_create\_addr\_space(3libunwind), unw\_get\_proc\_name(3libunwind), unw\_get\_proc\_info(3libunwind), unw\_init\_remote(3libunwind)

## AUTHOR

David Mosberger-Tang\
 Email: **dmosberger@gmail.com**\
 WWW: **http://www.nongnu.org/libunwind/**.
