---
name: "dwarf_add_die_to_debug"
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_add_die_to_debug"
---

# dwarf\_add\_die\_to\_debug(3)

set the root debugging information entry

## NAME

**dwarf\_add\_die\_to\_debug** – set the root debugging information entry

## LIBRARY

library “libdwarf”

## SYNOPSIS

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

*Dwarf\_Unsigned*\

**dwarf\_add\_die\_to\_debug**(*Dwarf\_P\_Debug dbg*, *Dwarf\_P\_Die first\_die*, *Dwarf\_Error \*err*);

## DESCRIPTION

Function **dwarf\_add\_die\_to\_debug**() sets the root debugging information entry of a DWARF producer instance. All debugging information entries linked to the root entry will also be added to the producer instance.

Argument *dbg* should reference a DWARF producer instance allocated using [dwarf\_producer\_init(3)](/dwarf_producer_init/3.md) or [dwarf\_producer\_init\_b(3)](/dwarf_producer_init_b/3.md).

Argument *first\_die* should hold the debugging information entry which will become the root DIE.

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

## RETURN VALUES

On success, function **dwarf\_add\_die\_to\_debug**() returns DW\_DLV\_OK. In case of an error, function **dwarf\_add\_die\_to\_debug**() returns DW\_DLV\_NOCOUNT and sets the argument *err*.

## ERRORS

Function **dwarf\_add\_die\_to\_debug**() can fail with:

- \[DW\_DLE\_ARGUMENT\]

  Either of the arguments *dbg* or *first\_die* was NULL.

## SEE ALSO

[dwarf(3)](/dwarf/3.md), [dwarf\_die\_link(3)](/dwarf_die_link/3.md), [dwarf\_new\_die(3)](/dwarf_new_die/3.md), [dwarf\_producer\_init(3)](/dwarf_producer_init/3.md), [dwarf\_producer\_init\_b(3)](/dwarf_producer_init_b/3.md)
