---
name: "dwarf_add_arange_b"
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_arange"
---

# dwarf\_add\_arange\_b(3)

add address range information to a DWARF producer instance

Part of [dwarf\_add\_arange(3)](/dwarf_add_arange/3.md).

## NAME

**dwarf\_add\_arange**, **dwarf\_add\_arange\_b** – add address range information to a DWARF producer instance

## LIBRARY

library “libdwarf”

## SYNOPSIS

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

*Dwarf\_Unsigned*\

**dwarf\_add\_arange**(*Dwarf\_P\_Debug dbg*, *Dwarf\_Addr start*, *Dwarf\_Unsigned length*, *Dwarf\_Signed symbol\_index*, *Dwarf\_Error \*err*);

*Dwarf\_Unsigned*\

**dwarf\_add\_arange\_b**(*Dwarf\_P\_Debug dbg*, *Dwarf\_Addr start*, *Dwarf\_Unsigned length*, *Dwarf\_Unsigned symbol\_index*, *Dwarf\_Unsigned end\_symbol\_index*, *Dwarf\_Addr offset\_from\_end\_symbol*, *Dwarf\_Error \*err*);

## DESCRIPTION

Function **dwarf\_add\_arange\_b**() adds an address range entry to a 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 *start* specifies the relocatable start address of the address range.

Argument *length* specifies the length of the address range.

Argument *symbol\_index* specifies the ELF symbol index of the first symbol to be used for relocation.

Argument *end\_symbol\_index* specifies the ELF symbol index of the second symbol to be used for relocation.

- If argument *end\_symbol\_index* is not 0, the DW\_DLC\_SYMBOLIC\_RELOCATIONS flag should have been set on the DWARF producer instance. The address value specified by argument *start* will be treated as an offset value from the first symbol, and the argument *offset\_from\_end\_symbol* should hold an offset value from the second symbol. Application code can retrieve the relocation entries for the symbol pair by calling function [dwarf\_get\_relocation\_info(3)](/dwarf_get_relocation_info/3.md). The relocation entry for the first symbol will have type dwarf\_drt\_first\_of\_length\_pair and the relocation entry for the second symbol will have type dwarf\_drt\_second\_of\_length\_pair.

- If argument *end\_symbol\_index* is 0, argument *offset\_from\_end\_symbol* will be ignored and only one symbol is used for relocation.

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

Function **dwarf\_add\_arange**() is deprecated. It is similar to function **dwarf\_add\_arange\_b**() except that it cannot handle all possible symbol index values and supports only one relocation symbol.

## RETURN VALUES

On success, these functions return a non-zero value. In case of an error, these functions return 0 and set the argument *err*.

## ERRORS

These functions can fail with:

- \[DW\_DLE\_ARGUMENT\]

  Argument *dbg* was NULL.

- \[DW\_DLE\_ARGUMENT\]

  Argument *end\_symbol\_index* was non-zero, but the flag DW\_DLC\_SYMBOLIC\_RELOCATIONS was not set on the producer instance.

- \[DW\_DLE\_MEMORY\]

  An out of memory condition was encountered during the execution of the function.

## SEE ALSO

[dwarf(3)](/dwarf/3.md), [dwarf\_get\_relocation\_info(3)](/dwarf_get_relocation_info/3.md), [dwarf\_producer\_init(3)](/dwarf_producer_init/3.md), [dwarf\_producer\_init\_b(3)](/dwarf_producer_init_b/3.md)
