---
name: "dwarf_get_fde_list"
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_get_fde_list"
---

# dwarf\_get\_fde\_list(3)

retrieve frame information

## NAME

**dwarf\_get\_fde\_list** – retrieve frame information

## LIBRARY

library “libdwarf”

## SYNOPSIS

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

*int*\

**dwarf\_get\_fde\_list**(*Dwarf\_Debug dbg*, *Dwarf\_Cie \*\*cie\_list*, *Dwarf\_Signed \*cie\_count*, *Dwarf\_Fde \*\*fde\_list*, *Dwarf\_Signed \*fde\_count*, *Dwarf\_Error \*err*);

*int*\

**dwarf\_get\_fde\_list\_eh**(*Dwarf\_Debug dbg*, *Dwarf\_Cie \*\*cie\_list*, *Dwarf\_Signed \*cie\_count*, *Dwarf\_Fde \*\*fde\_list*, *Dwarf\_Signed \*fde\_count*, *Dwarf\_Error \*err*);

## DESCRIPTION

These functions retrieve frame related information for the specified DWARF debug context.

Function **dwarf\_get\_fde\_list**() retrieves frame information from the DWARF section named “.debug\_frame”. For objects containing GNU style C++ exception handling information, the function **dwarf\_get\_fde\_list\_eh**() retrieves frame information from the section named “.eh\_frame”.

Frame information is returned using opaque descriptors of type *Dwarf\_Cie* and *Dwarf\_Fde*. Applications need to use the other frame related functions in the DWARF(3) API set to retrieve the information contained in these descriptors.

Argument *dbg* should reference a DWARF debug context allocated using [dwarf\_init(3)](/dwarf_init/3.md).

Argument *cie\_list* should point to a location that will be set to a pointer to an array of *Dwarf\_Cie* descriptors.

Argument *cie\_count* should point to a location that will be set to the number of *Dwarf\_Cie* descriptors returned.

Argument *fde\_list* should point to a location that will be set to a pointer to an array of *Dwarf\_Fde* descriptors.

Argument *fde\_count* should point to a location that will be set to the number of *Dwarf\_Fde* descriptors returned.

If argument *err* is not NULL, it will be used to store error information in case of an error.

### Memory Management

The memory areas used for the arrays returned in arguments *cie\_list* and *fde\_list* are owned by the library “libdwarf”. Application code should not attempt to directly free these areas. Portable applications should instead use the [dwarf\_fde\_cie\_list\_dealloc(3)](/dwarf_fde_cie_list_dealloc/3.md) function to indicate that these memory areas may be freed.

## RETURN VALUES

On success, these functions returns DW\_DLV\_OK. They return DW\_DLV\_NO\_ENTRY if there is no frame information associated with the given DWARF debug context. In case of an error, they return DW\_DLV\_ERROR and set the argument *err*.

## EXAMPLES

To obtain frame information from the “.debug\_frame” section, use:

```
Dwarf_Debug dbg;
Dwarf_Cie *cie_list, cie;
Dwarf_Fde *fde_list, fde;
Dwarf_Off fde_offset, cie_offset;
Dwarf_Unsigned func_len, fde_length, fde_instlen;
Dwarf_Signed cie_count, fde_count, cie_index;
Dwarf_Addr low_pc;
Dwarf_Ptr fde_addr, fde_inst, cie_inst;
Dwarf_Error de;
int i;
if (dwarf_get_fde_list(dbg, &cie_list, &cie_count,
    &fde_list, &fde_count, &de) != DW_DLV_OK) {
	errx(EXIT_FAILURE, "dwarf_get_fde_list failed: %s",
	    dwarf_errmsg(de));
}
for (i = 0; i < fde_count; i++) {
	if (dwarf_get_fde_n(fde_list, i, &fde, &de) != DW_DLV_OK) {
		warnx("dwarf_get_fde_n failed: %s",
		    dwarf_errmsg(de));
		continue;
	}
	if (dwarf_get_cie_of_fde(fde, &cie, &de) != DW_DLV_OK) {
		warnx("dwarf_get_fde_n failed: %s",
		    dwarf_errmsg(de));
		continue;
	}
	if (dwarf_get_fde_range(fde, &low_pc, &func_len, &fde_addr,
	    &fde_length, &cie_offset, &cie_index, &fde_offset,
	    &de) != DW_DLV_OK) {
		warnx("dwarf_get_fde_range failed: %s",
		    dwarf_errmsg(de));
		continue;
	}
	if (dwarf_get_fde_instr_bytes(fde, &fde_inst, &fde_instlen,
	    &de) != DW_DLV_OK) {
		warnx("dwarf_get_fde_instr_bytes failed: %s",
		    dwarf_errmsg(de));
		continue;
	}
	/* ... Use the retrieved frame information ... */
}
/* Indicate that the returned arrays may be freed. */
dwarf_fde_cie_list_dealloc(dbg, cie_list, cie_count, fde_list,
    fde_count);
```

## ERRORS

These functions may fail with the following errors:

- \[DW\_DLE\_ARGUMENT\]

  One of the arguments *dbg*, *cie\_list*, *cie\_count*, *fde\_list* or *fde\_count* was NULL.

- \[DW\_DLE\_NO\_ENTRY\]

  There is no frame information associated with the giving DWARF debug context.

## SEE ALSO

[dwarf(3)](/dwarf/3.md), [dwarf\_fde\_cie\_list\_dealloc(3)](/dwarf_fde_cie_list_dealloc/3.md), [dwarf\_get\_cie\_index(3)](/dwarf_get_cie_index/3.md), [dwarf\_get\_cie\_of\_fde(3)](/dwarf_get_cie_of_fde/3.md), [dwarf\_get\_fde\_at\_pc(3)](/dwarf_get_fde_at_pc/3.md), [dwarf\_get\_fde\_instr\_bytes(3)](/dwarf_get_fde_instr_bytes/3.md), [dwarf\_get\_fde\_n(3)](/dwarf_get_fde_n/3.md), [dwarf\_get\_fde\_range(3)](/dwarf_get_fde_range/3.md), [dwarf\_set\_frame\_cfa\_value(3)](/dwarf_set_frame_cfa_value/3.md), [dwarf\_set\_frame\_rule\_initial\_value(3)](/dwarf_set_frame_rule_initial_value/3.md), [dwarf\_set\_frame\_rule\_table\_size(3)](/dwarf_set_frame_rule_table_size/3.md), [dwarf\_set\_frame\_same\_value(3)](/dwarf_set_frame_same_value/3.md), [dwarf\_set\_frame\_undefined\_value(3)](/dwarf_set_frame_undefined_value/3.md)
