UNW_GE...O_BY_IP(3libunwind)
π NAME π
unw_get_proc_info_by_ip β bestie, this one grabs your procedure info by IP β¨ (and yeah, it lives in the 3libunwind manual, section 3, we love a library girlie π)
πΈ 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 π¦
okay so unw_get_proc_info_by_ip() hands you the same kind of auxiliary info about a procedure that unw_get_proc_info() does β except the tea is that it looks that info up by instruction-pointer (IP) instead of by a cursor. it's giving β¨flexibilityβ¨ because you can look up the info for literally any arbitrary procedure, even one that's not part of the current call chain at all. main character behavior, honestly.
but bestie, hear me: because it's more flexible, it also tends to run slower than unw_get_proc_info() β and often much slower. no cap. π
here's the vibe check on the arguments, one by one:
asβ the address-space where the instruction pointer should be looked up. if you're doing a look-up in the local address-space, you can just passunw_local_addr_spacehere. easy πipβ the instruction-pointer</> you want the procedure info for.pipβ a pointer to a structure of typeunw_proc_info_t, which is where the info gets returned. that's the lil delivery box π¦argβ the address space argument that should be used when accessing the address space. it has the exact same purpose as the argument of the same name forunw_init_remote(). π«Ά
β οΈ important: when you're accessing the local address space (i.e. the first argument isunw_local_addr_space), you must passNULLforarg. don't be out here passing random stuff, it's not the move.
also, for the purposes of libunwind, the code of a procedure is assumed to occupy a single, contiguous range of addresses π. because of that, it's always possible to describe the extent of a procedure with the start_ip and end_ip members. so if one single function/routine is split into multiple, discontiguous pieces? libunwind will treat each piece as a separate procedure. periodt. π
π₯ RETURN VALUE π₯
on successful completion, unw_get_proc_info_by_ip() returns 0 β¨. otherwise it returns the negative value of one of the error-codes below. not a vibe, but okay.
π§ THREAD AND SIGNAL SAFETY π§
unw_get_proc_info_by_ip() is thread safe π. and if the local address space is passed in argument as, this routine is also safe to use from a signal handler. iconic, honestly.
π ERRORS π
UNW_EUNSPECβ an unspecified error occurred. like, something happened, we don't know what. πUNW_ENOINFOβ libunwind was unable to locate unwind-info for the procedure. the info said "not found bestie" πUNW_EBADVERSIONβ the unwind-info for the procedure has a version or format that is not understood by libunwind. it's giving "we don't speak that language" π
in addition, unw_get_proc_info_by_ip() may return any error returned by the access_mem() callback (peep 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/
okay that's the whole page bestie, you ate π
β¨ this one's from the Programming Library era, dated 29 August 2023, and it's filed under UNW_GE...O_BY_IP(3libunwind) π go forth and unwind π¦π
π¦ where this page comes from
- debian trixie: libunwind-dev 1.8.1-0.1 Β· MIT
- ubuntu questing: libunwind-dev 1.8.1-0.1ubuntu1
- ubuntu resolute: libunwind-dev 1.8.3-0ubuntu1 Β· MIT
- ubuntu stonking: libunwind-dev 1.8.3-0ubuntu1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms