DWARF_HASATTR(3)

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

✨ DWARF_HASATTR ✨

okay so bestie, this one's from the DWARF Access Library β€” that's libdwarf, and you link it with -ldwarf. it's your lil' bestie for poking at DWARF debug info, iykyk 🧚


🌸 NAME 🌸

dwarf_hasattr β€” the "does this DIE even have that attribute" check πŸ’…

πŸŽ€ LIBRARY πŸŽ€

DWARF Access Library (libdwarf, -ldwarf)

⭐ SYNOPSIS ⭐

#include <libdwarf.h>

int
dwarf_hasattr(Dwarf_Die die, Dwarf_Half attr, Dwarf_Bool *ret_bool,
    Dwarf_Error *err);

πŸ¦‹ DESCRIPTION πŸ¦‹

so dwarf_hasattr() is literally the vibe check for attributes πŸ”₯ it tests whether the debugging information entry you referenced in argument die contains the attribute named by argument attr.

legal values for argument attr are the ones denoted by the DW_AT_* constants in the DWARF specification β€” no invented ones, bestie, we stay in spec ✨

if the named attribute is present in the debugging information entry, dwarf_hasattr() returns a non-zero value in the location pointed to by argument ret_bool πŸ’– if the named attribute is not present, a zero gets written instead. either way you get a real answer, slay.

if argument err is not NULL, it will be used to return an error descriptor in case of an error. so like, pass it if you want the receipts 🧾

πŸ‘‘ RETURN VALUES πŸ‘‘

on success, dwarf_hasattr() returns DW_DLV_OK β€” king behavior πŸ‘‘

in case of an error, it returns DW_DLV_ERROR and sets argument err. 😭

πŸ’€ ERRORS πŸ’€

dwarf_hasattr() can fail with exactly this one error:

  • [DW_DLE_ARGUMENT] β€” either of argument die or ret_bool was NULL. yeah, passing NULL is not the move, bestie πŸ™ˆ
ngl, that NULL check is the whole error list β€” no secret extra failures hiding in here, fr fr.

🌈 SEE ALSO 🌈


and that's the whole page, no cap 🫢 this cutie came from Debian, dated April 17, 2010 β€” yeah she's an elder Gen Z, respect the icon πŸŽ€βœ¨πŸ’œ

πŸ“¦ where this page comes from