---
name: "dwarf_next_types_section"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/dwarf_next_types_section"
---

# dwarf\_next\_types\_section(3)

step through .debug\_types sections in a debug context

## NAME

**dwarf\_next\_types\_section** – step through .debug\_types sections in a debug context

## LIBRARY

library “libdwarf”

## SYNOPSIS

**#include \<libdwarf.h\>**

*int*\

**dwarf\_next\_types\_section**(*Dwarf\_Debug dbg*, *Dwarf\_Error \*err*);

## DESCRIPTION

Function **dwarf\_next\_types\_section**() steps through the “.debug\_types” sections found in a debug context.

Argument *dbg* should reference a DWARF debug context allocated using [dwarf\_init(3)](/dwarf_init/3.md). 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)](/dwarf_init/3.md), an internal pointer associated with the context will point to the first “.debug\_types” section present in the debug object. 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. 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)](/dwarf_next_cu_header_c/3.md) to iterate though the type units associated with the current “.debug\_types” section.

## RETURN VALUES

On success, function **dwarf\_next\_types\_section**() returns DW\_DLV\_OK.

In case of an error, it returns DW\_DLV\_ERROR and sets argument *err*. When there are no more “.debug\_types” sections left to traverse, it returns DW\_DLV\_NO\_ENTRY.

## EXAMPLES

To iterate though every type unit in all the “.debug\_types” sections found in a debug context:

```
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.

## ERRORS

The **dwarf\_next\_types\_section**() function may fail with the following errors:

- \[DW\_DLE\_ARGUMENT\]

  Argument *dbg* was NULL.

## SEE ALSO

[dwarf(3)](/dwarf/3.md), [dwarf\_init(3)](/dwarf_init/3.md), [dwarf\_next\_cu\_header\_c(3)](/dwarf_next_cu_header_c/3.md)
