DWARF_ADD_AT_UNSIGNED_CONST(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’… dwarf_add_AT_signed_const, dwarf_add_AT_unsigned_const β€” create and attach constant class attributes

okay so bestie, you're in libdwarf territory now β€” the DWARF Access Library (libdwarf, link it with -ldwarf) β€” and this page is all about two lil twin functions that make constant-class attribute descriptors and stick them onto a DIE. iconic behaviour, honestly. ✨


✨ 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 🌸

so these two functions create attribute descriptors that belong to the β€˜constant’ class, and then attach them to the debugging information entry that argument die points at. that's the whole vibe. πŸŽ€

here's the cast of characters:

now the twins get their own moment:

  • dwarf_add_AT_signed_const() creates an attribute descriptor carrying the signed value you passed in value. πŸ’–
  • dwarf_add_AT_unsigned_const() creates an attribute descriptor carrying the unsigned value you passed in value. πŸ’œ

and here's the fun part β€” the attribute these functions create 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 you put in value. it picks for you, no cap. πŸ¦‹

one more thing: if err is not NULL, these functions will use it to store error information in case of an error. so pass it if you want the tea. 😭


πŸ”₯ RETURN VALUES πŸ”₯

on success, these functions return the created attribute descriptor. slay.

in case of an error, they return DW_DLV_BADADDR and set the argument err. that's your vibe check failing, bestie. πŸ’€


🧚 ERRORS 🧚

these functions can fail with:

  • [DW_DLE_ARGUMENT] β€” either of the arguments dbg or die was NULL. (like, rude? but okay.)
  • [DW_DLE_MEMORY] β€” an out of memory condition was encountered during execution. 🫠

⭐ SEE ALSO ⭐

dwarf(3), dwarf_add_AT_const_value_signedint(3), dwarf_add_AT_const_value_unsignedint(3), dwarf_add_AT_dataref(3), dwarf_add_AT_ref_address(3), dwarf_add_AT_targ_address_b(3), dwarf_new_die(3), dwarf_producer_init(3), dwarf_producer_init_b(3)


okay that's the whole page, you ate that πŸ“ go forth and attach your constants. this one's from the Debian manual, dated September 4, 2011, and the page itself is DWARF_ADD_AT_SIGNED_CONST(3) β€” mwah, mwah, periodt πŸ‘‘πŸ’…

πŸ“¦ where this page comes from