---
name: "dwarf_hasform"
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_hasform"
---

# dwarf\_hasform(3)

query attribute forms

## NAME

**dwarf\_hasform**, **dwarf\_whatform**, **dwarf\_whatform\_direct** – query attribute forms

## LIBRARY

library “libdwarf”

## SYNOPSIS

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

*int*\

**dwarf\_hasform**(*Dwarf\_Attribute attr*, *Dwarf\_Half form*, *Dwarf\_Bool \*ret*, *Dwarf\_Error \*err*);

*int*\

**dwarf\_whatform**(*Dwarf\_Attribute attr*, *Dwarf\_Half \*retform*, *Dwarf\_Error \*err*);

*int*\

**dwarf\_whatform\_direct**(*Dwarf\_Attribute attr*, *Dwarf\_Half \*retform*, *Dwarf\_Error \*err*);

## DESCRIPTION

Function **dwarf\_hasform**() indicates whether the DWARF attribute denoted by argument *attr* has the attribute form specified by argument *form*. If the attribute has the specified form, then argument *ret* is set to a non-zero value, otherwise it is set to zero. If argument *err* is non-NULL, it will be used to return an error descriptor in case of an error.

Function **dwarf\_whatform**() sets the location specified by argument *retform* to the attribute form code for the DWARF attribute referenced by argument *attr*. If the attribute referenced by argument *attr* has an indirect form attribute, this function will return the final form for the attribute. If argument *err* is non-NULL, it will be used to return an error descriptor in case of an error.

Function **dwarf\_whatform\_direct**() sets the location specified by argument *retform* to the attribute form code for the DWARF attribute referenced by argument *attr*. If the form is an indirect form, the function sets the location specified by argument *retform* to DW\_FORM\_indirect. If argument *err* is non-NULL, it will be used to return an error descriptor in case of an error.

## RETURN VALUES

These functions return DW\_DLV\_OK on success. In case of an error, these functions return DW\_DLV\_ERR and set argument *err*.

## ERRORS

These functions may fail with the following errors:

- \[DW\_DLE\_ARGUMENT\]

  Any of the arguments *attr*, *ret*, or *retform* was NULL.

## SEE ALSO

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