UNW_SE...UNCTION(3libunwind)
β¨ UNW_SET_ITERATE_PHDR_FUNCTION β¨
okay so bestie, you found a page from libunwind (the Programming Library, no less π ) and it's literally all about telling libunwind how to go walk the program headers. it's giving very niche, very powerful, and i'm obsessed π
πΈ NAME πΈ
unw_set_iterate_phdr_function β set the dl_iterate_phdr implementation, periodt π
π¦ SYNOPSIS π¦
#include <libunwind.h>
typedef int (*unw_iterate_phdr_callback_t)(struct dl_phdr_info *,
size_t, void *);
typedef int (*unw_iterate_phdr_func_t)(unw_iterate_phdr_callback_t, void
*);
void unw_set_iterate_phdr_function(unw_addr_space_t as,
unw_iterate_phdr_func_t function);
like, copy that exactly bestie, character for character, no notes π«Ά
π DESCRIPTION π
so unw_set_iterate_phdr_function() is the routine that sets the dl_iterate_phdr implementation of the address space as to the function you pass in as the argument function. yep, that's the whole vibe: you hand it your function, and libunwind is like "say less, this is my phdr iterator now" πβ¨
that function of yours gets called whenever libunwind needs to iterate over the program headers of the application. normally that job is done by calling dl_iterate_phdr, but β and this is the part where we gasp π β that function is not signal safe. not even a little.
so with the help of a custom implementation, caching and iterating over the program headers is also possible in a signal-safe manner π. but here's the tea: the burden lies on the user of libunwind. that's you. you're the main character now π. no cap.
π THREAD AND SIGNAL SAFETY π
unw_set_iterate_phdr_function() is thread safe π§ β iconic behaviour, honestly.
and if the local address space is passed in argument as, this routine is also safe to use from a signal handler π₯. slay.
β SEE ALSO β
libunwind(3libunwind)unw_create_addr_space(3libunwind)dl_iterate_phdr(3libunwind),
(yes the comma's there, i don't make the rules π)
π AUTHOR π
Bert Wesarg Email: bert.wesarg@googlemail.com WWW: http://www.nongnu.org/libunwind/.
and that's the whole page bestie!! it came from the Programming Library side of things, dated 29 August 2023 β big libunwind energy, iykyk πβ¨π¦ go forth and iterate those program headers safely, you absolute legend πππ
π¦ where this page comes from
- alpine 3.22: libunwind-doc 1.8.1-r0 Β· MIT
- alpine 3.23: libunwind-doc 1.8.1-r0 Β· MIT
- alpine 3.24: libunwind-doc 1.8.3-r0 Β· MIT
- arch rolling: libunwind 1.8.3-1 Β· MIT
- epel 10: libunwind-devel 1.8.0-4.el10_0 Β· MIT
- epel 9: libunwind-devel 1.8.0-4.el9 Β· MIT
- fedora 43: libunwind-devel 1.8.1-3.fc43 Β· MIT
- fedora 43: libunwind-devel 1.8.1-3.fc43 Β· MIT
- fedora 43: libunwind-devel 1.8.3-4.fc43 Β· MIT
- fedora 43: libunwind-devel 1.8.3-4.fc43 Β· MIT
- fedora 44: libunwind-devel 1.8.3-1.fc44 Β· MIT
- fedora 44: libunwind-devel 1.8.3-1.fc44 Β· MIT
- fedora 44: libunwind-devel 1.8.3-4.fc44 Β· MIT
- fedora 44: libunwind-devel 1.8.3-4.fc44 Β· MIT
- nixpkgs unstable: libunwind 1.8.3-devman
- opensuse-leap 16.0: libunwind-devel 1.8.1-160000.2.2 Β· MIT
- opensuse-leap 16.0: libunwind-devel 1.8.1-160000.2.2 Β· MIT
- opensuse-leap 16.0: libunwind-devel 1.8.1-160000.2.2 Β· MIT
- opensuse-leap 16.0: libunwind-devel 1.8.1-160000.2.2 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms