UNW_STEP(3libunwind)
β¨ UNW_STEP β advance to next stack frame β¨
okay bestie, this is a page from the libunwind programming library, and today's main character is unw_step. it's giving "walk the stack, one frame at a time" π
πΈ SYNOPSIS πΈ
#include <libunwind.h>
int unw_step(unw_cursor_t *cp);
π DESCRIPTION π
so unw_step() takes your unwind cursor cp and advances it to the next older, less deeply nested stack frame. that's it, that's the whole vibe. you're literally just walking up the stack, frame by frame, like scrolling up in a group chat to find the message where it all went wrong π
π RETURN VALUE π
on a successful completion, here's the tea:
unw_step()returns a positive value if the updated cursor is pointing at a valid stack frame π«Ά- it returns
0if the previous stack frame was the last frame in the chain (you hit the end, no more scrolling bestie) - on error, it returns the negative value of one of the error codes listed below π
π¦ THREAD AND SIGNAL SAFETY π¦
unw_step() is thread-safe. periodt. β¨
and if the cursor cp is in the local address-space, this routine is also safe to use from a signal handler. iconic behaviour fr fr.
π ERRORS π
here's the full roster of ways this can go sideways. no skipping, we list them all:
UNW_EUNSPECβ an unspecified error occurred. (mystery error, very main character, zero explanation π)UNW_ENOINFOβ libunwind was unable to locate the unwind-info needed to complete the operation.UNW_EBADVERSIONβ the unwind-info needed to complete the operation has a version or a format that is not understood by libunwind.UNW_EINVALIDIPβ the instruction-pointer (program-counter) of the next stack frame is invalid (e.g., not properly aligned).UNW_EBADFRAMEβ the next stack frame is invalid. πUNW_ESTOPUNWINDβ returned if a call tofind_proc_info()returned-UNW_ESTOPUNWIND.
also, heads up:unw_step()may return any error returned by thefind_proc_info(),get_dyn_info_list_addr(),access_mem(),access_reg(), oraccess_fpreg()call-backs β seeunw_create_addr_space(3libunwind). so if one of those is acting up, that's on them, not onunw_step()π«
π SEE ALSO π
π AUTHOR π
David Mosberger-Tang
- Email:
dmosberger@gmail.com - WWW:
http://www.nongnu.org/libunwind/
and that's the whole page, bestie π this one's from the Programming Library, dated 29 August 2023, and it lives under the name UNW_STEP(3libunwind). slay, go unwind something. πΈπ¦β¨
π¦ 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