DWARF_ADD_AT_NAME(3)

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

✨ NAME ✨

okay so welcome to the DWARF_ADD_AT_NAME(3) page, bestie β€” this is one of those Library Functions Manual situations (libdwarf girlies rise 🫢), and the function in question is dwarf_add_AT_name β€” it creates and attaches a DW_AT_name attribute πŸ’…


πŸŽ€ LIBRARY πŸŽ€

DWARF Access Library β€” and you link it with -ldwarf, no cap ✨

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <libdwarf.h>

Dwarf_P_Attribute
dwarf_add_AT_name(Dwarf_P_Die die, char *name, Dwarf_Error *err);

🌸 DESCRIPTION 🌸

So here's the tea β˜•: dwarf_add_AT_name() does two things in one iconic move β€” it creates a DW_AT_name attribute descriptor, and then attaches it to the debugging information entry that die points at. And the created attribute is gonna have DWARF form DW_FORM_strp. that's just how it is, periodt πŸ’–

Quick vibe check on the args:

  • die β€” this one should reference a debugging information entry that was allocated using dwarf_new_die(3). like, don't just make one up out of nowhere, bestie 😭
  • name β€” should point to a NUL-terminated string, and that string becomes the value of the created attribute. that's literally the whole job πŸŽ€
  • err β€” if it's not NULL, it gets used to store error information in case of an error. if it is NULL, well, she's not keeping receipts πŸ™ˆ

πŸ‘‘ RETURN VALUES πŸ‘‘

On success β€” slay πŸ’… β€” dwarf_add_AT_name() returns the created attribute descriptor.

In case of an error, she returns DW_DLV_BADADDR and sets the argument err. so at least you'll know πŸ’€

πŸ”₯ ERRORS πŸ”₯

Function dwarf_add_AT_name() can fail with:

  • [DW_DLE_ARGUMENT] β€” one of the arguments die or name was NULL. yeah, that'll do it 😭
  • [DW_DLE_MEMORY] β€” an out of memory condition was encountered during the execution of this function. lowkey the worst vibe 🌧️

πŸ’œ SEE ALSO πŸ’œ

dwarf(3), dwarf_add_AT_comp_dir(3), dwarf_add_AT_const_value_string(3), dwarf_add_AT_producer(3), dwarf_add_AT_string(3), dwarf_new_die(3) β€” go read the whole friend group, iykyk ✨


and that's the page, bestie 🫢 this one's from Debian, dated September 4, 2011, and it's DWARF_ADD_AT_NAME(3) β€” mwah, go write some debug info πŸ’–πŸŽ€πŸŒΈ

πŸ“¦ where this page comes from