---
name: "dwarf_hasattr"
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_hasattr"
---

# dwarf\_hasattr(3)

check for the presence of an attribute

## NAME

**dwarf\_hasattr** – check for the presence of an attribute

## LIBRARY

library “libdwarf”

## SYNOPSIS

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

*int*\

**dwarf\_hasattr**(*Dwarf\_Die die*, *Dwarf\_Half attr*, *Dwarf\_Bool \*ret\_bool*, *Dwarf\_Error \*err*);

## DESCRIPTION

Function **dwarf\_hasattr**() tests whether the debugging information entry referenced in argument *die* contains the attribute named by argument *attr*. Legal values for argument *attr* are those denoted by the DW\_AT\_\* constants in the DWARF specification.

If the named attribute is present in the debugging information entry, function **dwarf\_hasattr**() returns a non-zero value in the location pointed to by argument *ret\_bool*. If the named attribute is not present, a zero is written instead.

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\_hasattr**() returns DW\_DLV\_OK. In case of an error, it returns DW\_DLV\_ERROR and sets argument *err*.

## ERRORS

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

- \[DW\_DLE\_ARGUMENT\]

  Either of argument *die* or *ret\_bool* was NULL.

## SEE ALSO

[dwarf(3)](/dwarf/3.md), [dwarf\_attr(3)](/dwarf_attr/3.md), [dwarf\_whatattr(3)](/dwarf_whatattr/3.md)
