DWARF_GET_ADDRESS_SIZE(3)

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

✨ DWARF_GET_ADDRESS_SIZE πŸ’…

okay bestie, so this one lives in the DWARF Access Library (that's libdwarf, and you link it with -ldwarf πŸŽ€). It's a tiny little function but it's literally doing the most important thing: telling you how many bytes an address takes up. icon behavior, no cap.


🌸 SYNOPSIS 🌸

#include <libdwarf.h>

int
dwarf_get_address_size(Dwarf_Debug dbg, Dwarf_Half *addr_size,
    Dwarf_Error *err);

πŸ’– DESCRIPTION πŸ’–

okay so dwarf_get_address_size() returns the size in bytes of a native address for a program object. that's it, that's the whole vibe. ✨

  • dbg β€” this should denote a DWARF debug context that you created from a program object using dwarf_init(3). main character argument fr.
  • addr_size β€” point this at a location that will hold the returned size. like, give it somewhere to live 🫢
  • err β€” if it's non-NULL, it gets used to return error information. if you pass NULL, that's your choice bestie πŸ’€

πŸ¦‹ RETURN VALUES πŸ¦‹

On success, function dwarf_tag() returns DW_DLV_OK πŸ‘‘ (yes, the manpage really does say dwarf_tag() here β€” i'm not fixing it, i'm just reporting it, iykyk πŸ™ˆ).

In case of an error, it returns DW_DLV_ERROR and sets argument err. sad girl hours 😭


πŸ”₯ ERRORS πŸ”₯

Function dwarf_get_address_size() can fail with the following error:

  • [DW_DLE_ARGUMENT] β€” either of arguments dbg or addr_size was NULL. so like... actually pass them, bestie πŸ’…

🌈 SEE ALSO 🌈

dwarf(3), dwarf_finish(3), dwarf_init(3)


ngl this page is short and sweet and i'm obsessed with it. go read the friends it's referencing, they're the whole ecosystem. periodt. ⭐

Debian, April 14, 2010 β€” that's the source/version and date, mwah, signing off πŸ§šπŸ’œ

πŸ“¦ where this page comes from