---
name: "dwarf_formexprloc"
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_formexprloc"
---

# dwarf\_formexprloc(3)

return information about a location expression

## NAME

**dwarf\_formexprloc** – return information about a location expression

## LIBRARY

library “libdwarf”

## SYNOPSIS

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

*int*\

**dwarf\_formexprloc**(*Dwarf\_Attribute attr*, *Dwarf\_Unsigned \*retlen*, *Dwarf\_Ptr \*retexpr*, *Dwarf\_Error \*err*);

## DESCRIPTION

Function **dwarf\_formexprloc**() allows an application to retrieve the length and the bytes of a DWARF location expression.

Argument *attr* should reference a DWARF attribute of the form DW\_FORM\_exprloc. Argument *retlen* should point to a location that will be set to the length of the location expression. Argument *retexpr* should point to a location that will be set to a pointer to the content of the location expression itself.

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

### Memory Management

The application should not attempt to free the memory area referenced by the pointer returned in argument *retexpr*.

## RETURN VALUES

Function **dwarf\_formexprloc**() returns DW\_DLV\_OK on success. In case of an error, it returns DW\_DLV\_ERROR and sets argument *err*.

## ERRORS

Function **dwarf\_formexprloc**() may fail with the following errors:

- \[DW\_DLE\_ARGUMENT\]

  One of arguments *attr*, *retlen* or *retexpr* was NULL.

- \[DW\_DLE\_ATTR\_FORM\_BAD\]

  The attribute referenced by argument *attr* was not of form DW\_FORM\_exprloc.

## SEE ALSO

[dwarf(3)](/dwarf/3.md), [dwarf\_attr(3)](/dwarf_attr/3.md), [dwarf\_formblock(3)](/dwarf_formblock/3.md), [dwarf\_formflag(3)](/dwarf_formflag/3.md), [dwarf\_formref(3)](/dwarf_formref/3.md), [dwarf\_formsdata(3)](/dwarf_formsdata/3.md), [dwarf\_formsig8(3)](/dwarf_formsig8/3.md), [dwarf\_formstring(3)](/dwarf_formstring/3.md), [dwarf\_formudata(3)](/dwarf_formudata/3.md), [dwarf\_hasattr(3)](/dwarf_hasattr/3.md)
