DWARF_NEXT_TYPES_SECTION(3)
β¨ NAME β¨
dwarf_next_types_section β step through .debug_types sections in a debug context. This is the DWARF_NEXT_TYPES_SECTION(3) page from the Library Functions Manual, hiiii bestie π
π«Ά LIBRARY π«Ά
This one is chillinβ in the DWARF Access Library (libdwarf, -ldwarf) β iconic behavior, honestly π
π SYNOPSIS π
#include <libdwarf.h>
int
dwarf_next_types_section(Dwarf_Debug dbg, Dwarf_Error *err);
πΈ DESCRIPTION πΈ
Okay so, function dwarf_next_types_section() steps through the .debug_types sections found in a debug context. No cap, thatβs its whole little job β¨
Argument dbg should reference a DWARF debug context allocated using dwarf_init(3). Argument err should point to a location that will hold an error descriptor in case of an error π¨
When a DWARF debug context is allocated using dwarf_init(3), an internal pointer associated with the context will point to the first .debug_types section present in the debug object. Then, when the application calls function dwarf_next_types_section(), this internal pointer will move to the next .debug_types section present. On stepping past the last .debug_types section left in the debug context, function dwarf_next_types_section() returns DW_DLV_NO_ENTRY. And bestie, the next call to the function will restart from the first .debug_types section in the debug context π
Application code should call function dwarf_next_cu_header_c(3) to iterate through the type units associated with the current .debug_types section. Thatβs the move π«
π RETURN VALUES π
- On success, function
dwarf_next_types_section()returnsDW_DLV_OKβ - In case of an error, it returns
DW_DLV_ERRORand sets argumenterrπ - When there are no more
.debug_typessections left to traverse, it returnsDW_DLV_NO_ENTRYπ
π EXAMPLES π
To iterate through every type unit in all the .debug_types sections found in a debug context, do this exactly:
Dwarf_Debug dbg;
Dwarf_Sig8 sig8;
Dwarf_Unsigned typeoff;
Dwarf_Error de;
... allocate dbg using dwarf_init() etc ...
do {
while ((ret = dwarf_next_cu_header_c(dbg, 0, NULL, NULL, NULL,
NULL, NULL, NULL, &sig8, &typeoff, NULL, &de)) == DW_DLV_OK) {
/* Access DIEs etc ... */
}
} while (dwarf_next_types_section(dbg, &de) == DW_DLV_OK);
π¦ COMPATIBILITY π¦
This function is an extension to the DWARF(3) API β periodt π
β ERRORS β
The dwarf_next_types_section() function may fail with the following errors:
[DW_DLE_ARGUMENT]β ArgumentdbgwasNULL.
π SEE ALSO π
dwarf(3), dwarf_init(3), dwarf_next_cu_header_c(3) β go read these too, bestie, iykyk πβ¨
okay thatβs the whole page, mwah π β signing off from Debian, dated December 20, 2014, page DWARF_NEXT_TYPES_SECTION(3) π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: libdwarf 15.0.0
- Copyright (c) 2014 Kai Wang
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms