DWARF_ADD_AT_TARG_ADDRESS_B(3)

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

πŸ’… DWARF_ADD_AT_TARG_ADDRESS(3) β€” the manual page, bestie edition

okay so you're in the Library Functions Manual for DWARF_ADD_AT_TARG_ADDRESS(3) and honestly? you're about to learn how to make address-class attributes and it's gonna slay ✨


πŸŽ€ NAME πŸŽ€

dwarf_add_AT_targ_address, dwarf_add_AT_targ_address_b β€” create and attach address class attributes πŸ’–


🌸 LIBRARY 🌸

DWARF Access Library (libdwarf, -ldwarf)


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <libdwarf.h>

Dwarf_P_Attribute
dwarf_add_AT_targ_address(Dwarf_P_Debug dbg, Dwarf_P_Die die,
    Dwarf_Half attr, Dwarf_Unsigned pc_value, Dwarf_Signed sym_index,
    Dwarf_Error *err);

Dwarf_P_Attribute
dwarf_add_AT_targ_address_b(Dwarf_P_Debug dbg, Dwarf_P_Die die,
    Dwarf_Half attr, Dwarf_Unsigned pc_value, Dwarf_Unsigned sym_index,
    Dwarf_Error *err);

✨ DESCRIPTION ✨

so dwarf_add_AT_targ_address_b() is the main character here: it creates an attribute descriptor that belongs to the β€˜address’ class and attaches it to the debugging information entry that argument die points at. it's giving "I make attributes and I make them address-class" πŸ’…

the created attribute descriptor will have DWARF form DW_FORM_addr. and here's the tea: if flag DW_DLC_SIZE_64 is set on the producer instance, the attribute value will be 8 bytes in size. otherwise? the attribute value will be 4 bytes in size. no cap, that's just how it is ✨

  • argument dbg β€” should reference a DWARF producer instance allocated using dwarf_producer_init(3) or dwarf_producer_init_b(3). like, that's the vibe it needs to have already 🫢
  • argument die β€” should reference a debugging information entry allocated using dwarf_new_die(3) πŸ’–
  • argument attr β€” should specify the attribute code of the created attribute descriptor 🌸
  • argument pc_value β€” should hold a relocatable address value which will become the value of the created attribute descriptor πŸ¦‹
  • argument sym_index β€” should specify the ELF symbol index of the symbol to be used for relocating the address value πŸ‘‘
  • argument err β€” if it's not NULL, it will be used to store error information in case of an error. like a little error-holding bag πŸŽ€
🚨 important bestie moment: function dwarf_add_AT_targ_address() is deprecated. it's similar to dwarf_add_AT_targ_address_b() except that it cannot handle all possible symbol index values. so like… use the _b one, she ate πŸ’€

πŸ”₯ RETURN VALUES πŸ”₯

on success, these functions return the created attribute descriptor πŸŽ‰ in case of an error, these functions return DW_DLV_BADADDR and sets the argument err. yeah, the bad-address one, you know the one 😭


πŸ’€ ERRORS πŸ’€

these functions can fail with:

  • [DW_DLE_ARGUMENT] β€” either of the arguments dbg or die was NULL. like bestie, those gotta be actual things, not nothing πŸ™ˆ
  • [DW_DLE_MEMORY] β€” an out of memory condition was encountered during execution. ran out of RAM mid-slaying, tragic πŸ“

🌈 SEE ALSO 🌈

dwarf(3), dwarf_add_AT_const_value_unsignedint(3), dwarf_add_AT_dataref(3), dwarf_add_AT_ref_address(3), dwarf_add_AT_signed_const(3), dwarf_add_AT_unsigned_const(3), dwarf_new_die(3), dwarf_producer_init(3), dwarf_producer_init_b(3)

go read the whole friend group, they're all iconic ⭐


and that's the page!! this one's brought to you by Debian, dated September 4, 2011, and it lives under the handle DWARF_ADD_AT_TARG_ADDRESS(3) β€” mwah, go build some address attributes bestie πŸ’œπŸ§š

πŸ“¦ where this page comes from