---
name: "unw_set_iterate_phdr_function"
section: "3"
platform: "linux"
package: "libunwind"
version: "1.8.3-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/unw_set_iterate_phdr_function"
---

# unw\_set\_iterate\_phdr\_function(3)

## NAME

unw\_set\_iterate\_phdr\_function -- set dl\_iterate\_phdr implementation

## 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);\

## DESCRIPTION

The unw\_set\_iterate\_phdr\_function() routine sets the dl\_iterate\_phdr implementation of address space as to the function by argument function. The function will be called whenever libunwind needs to iterate over the program headers of the application.  This is normally done by calling dl\_iterate\_phdr, but this function is not signal safe.  With the help of a custom implementation caching and iterating over the program headers is also possible in an signal-safe manner.  Though the burden lies on the user of libunwind.

## THREAD AND SIGNAL SAFETY

unw\_set\_iterate\_phdr\_function() is thread safe. If the local address space  is passed in argument as, this routine is also safe to use from  a signal handler.

## SEE ALSO

libunwind(3libunwind), unw\_create\_addr\_space(3libunwind), dl\_iterate\_phdr(3libunwind),

## AUTHOR

Bert Wesarg\
 Email: **bert.wesarg@googlemail.com**\
 WWW: **http://www.nongnu.org/libunwind/**.
