---
name: "dwarf_add_AT_unsigned_const"
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_AT_signed_const"
---

# dwarf\_add\_AT\_unsigned\_const(3)

create and attach constant class attributes

Part of [dwarf\_add\_AT\_signed\_const(3)](/dwarf_add_AT_signed_const/3.md).

## NAME

**dwarf\_add\_AT\_signed\_const**, **dwarf\_add\_AT\_unsigned\_const** – create and attach constant class attributes

## LIBRARY

library “libdwarf”

## SYNOPSIS

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

*Dwarf\_P\_Attribute*\

**dwarf\_add\_AT\_signed\_const**(*Dwarf\_P\_Debug dbg*, *Dwarf\_P\_Die die*, *Dwarf\_Half attr*, *Dwarf\_Signed value*, *Dwarf\_Error \*err*);

*Dwarf\_P\_Attribute*\

**dwarf\_add\_AT\_unsigned\_const**(*Dwarf\_P\_Debug dbg*, *Dwarf\_P\_Die die*, *Dwarf\_Half attr*, *Dwarf\_Unsigned value*, *Dwarf\_Error \*err*);

## DESCRIPTION

These functions create attribute descriptors belonging to the ‘constant’ class and attach them to the debugging information entry referenced by argument *die*.

Argument *dbg* should reference a DWARF producer instance allocated using [dwarf\_producer\_init(3)](/dwarf_producer_init/3.md) or [dwarf\_producer\_init\_b(3)](/dwarf_producer_init_b/3.md).

Argument *die* should reference a debugging information entry allocated using [dwarf\_new\_die(3)](/dwarf_new_die/3.md).

Argument *attr* specifies the attribute code of the created attribute descriptor.

Function **dwarf\_add\_AT\_signed\_const**() creates an attribute descriptor with the signed value specified in argument *value*.

Function **dwarf\_add\_AT\_unsigned\_const**() creates an attribute descriptor with the unsigned value specified in argument *value*.

The attribute created by these function will have one of the DWARF forms DW\_FORM\_data1, DW\_FORM\_data2, DW\_FORM\_data4 or DW\_FORM\_data8, depending on the size of the value specified in argument *value*.

If argument *err* is not NULL, it will be used by these functions to store error information in case of an error.

## RETURN VALUES

On success, these functions return the created attribute descriptor. In case of an error, these functions return DW\_DLV\_BADADDR and set the argument *err*.

## ERRORS

These functions can fail with:

- \[DW\_DLE\_ARGUMENT\]

  Either of the arguments *dbg* or *die* was NULL.

- \[DW\_DLE\_MEMORY\]

  An out of memory condition was encountered during execution.

## SEE ALSO

[dwarf(3)](/dwarf/3.md), [dwarf\_add\_AT\_const\_value\_signedint(3)](/dwarf_add_AT_const_value_signedint/3.md), [dwarf\_add\_AT\_const\_value\_unsignedint(3)](/dwarf_add_AT_const_value_unsignedint/3.md), [dwarf\_add\_AT\_dataref(3)](/dwarf_add_AT_dataref/3.md), [dwarf\_add\_AT\_ref\_address(3)](/dwarf_add_AT_ref_address/3.md), [dwarf\_add\_AT\_targ\_address\_b(3)](/dwarf_add_AT_targ_address_b/3.md), [dwarf\_new\_die(3)](/dwarf_new_die/3.md), [dwarf\_producer\_init(3)](/dwarf_producer_init/3.md), [dwarf\_producer\_init\_b(3)](/dwarf_producer_init_b/3.md)
