---
name: "dwarf_add_expr_addr"
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_expr_addr"
---

# dwarf\_add\_expr\_addr(3)

add a DW\_OP\_addr location expression

## NAME

**dwarf\_add\_expr\_addr**, **dwarf\_add\_expr\_addr\_b** – add a DW\_OP\_addr location expression

## LIBRARY

library “libdwarf”

## SYNOPSIS

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

*Dwarf\_Unsigned*\

**dwarf\_add\_expr\_addr**(*Dwarf\_P\_Expr expr*, *Dwarf\_Unsigned address*, *Dwarf\_Signed sym\_index*, *Dwarf\_Error \*err*);

*Dwarf\_Unsigned*\

**dwarf\_add\_expr\_addr\_b**(*Dwarf\_P\_Expr expr*, *Dwarf\_Unsigned address*, *Dwarf\_Unsigned sym\_index*, *Dwarf\_Error \*err*);

## DESCRIPTION

Function **dwarf\_add\_expr\_addr\_b**() adds a DW\_OP\_addr location expression to the location expression descriptor referenced by argument *expr*.

Argument *expr* should reference a location expression descriptor allocated using the function [dwarf\_new\_expr(3)](/dwarf_new_expr/3.md).

Argument *address* specifies the operand, a relocatable address value.

Argument *sym\_index* specifies the ELF symbol index of the symbol to be 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\_expr\_addr**() is deprecated. It is similar to function **dwarf\_add\_expr\_addr\_b**() except that it cannot handle all possible symbol index values.

## RETURN VALUES

On success, these functions return the size in bytes of the location expression byte stream generated. In case of an error, these functions return DW\_DLV\_NOCOUNT and set the argument *err*.

## ERRORS

These functions can fail with:

- \[DW\_DLE\_ARGUMENT\]

  Argument *expr* was NULL.

- \[DW\_DLE\_MEMORY\]

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

## SEE ALSO

[dwarf(3)](/dwarf/3.md), [dwarf\_add\_AT\_location\_expr(3)](/dwarf_add_AT_location_expr/3.md), [dwarf\_add\_expr\_gen(3)](/dwarf_add_expr_gen/3.md), [dwarf\_expr\_current\_offset(3)](/dwarf_expr_current_offset/3.md), [dwarf\_expr\_into\_block(3)](/dwarf_expr_into_block/3.md), [dwarf\_new\_expr(3)](/dwarf_new_expr/3.md)
