---
name: "dwarf_whatattr"
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_whatattr"
---

# dwarf\_whatattr(3)

retrieve the attribute code for a DWARF attribute

## NAME

**dwarf\_whatattr** – retrieve the attribute code for a DWARF attribute

## LIBRARY

library “libdwarf”

## SYNOPSIS

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

*int*\

**dwarf\_whatattr**(*Dwarf\_Attribute attr*, *Dwarf\_Half \*retcode*, *Dwarf\_Error \*err*);

## DESCRIPTION

Function **dwarf\_whatattr**() retrieves the attribute code for the DWARF attribute referenced by argument *attr*, and writes it to the location pointed to by argument *retcode*. If argument *err* is not NULL, it will be used to return an error descriptor in case of an error.

## RETURN VALUES

On success, function **dwarf\_whatattr**() returns DW\_DLV\_OK. In case of an error, it returns DW\_DLV\_ERROR and sets argument *err*.

## ERRORS

Function **dwarf\_whatattr**() can fail with the following error:

- \[DW\_DLE\_ARGUMENT\]

  Either of argument *attr* or *retcode* was NULL.

## SEE ALSO

[dwarf(3)](/dwarf/3.md), [dwarf\_attr(3)](/dwarf_attr/3.md), [dwarf\_hasattr(3)](/dwarf_hasattr/3.md)
