DWARF_ATTRVAL_SIGNED(3)
π NAME π
okay bestie, this is the Library Functions Manual page for DWARF_ATTRVAL_SIGNED(3), and it's literally the squad of functions that retrieve the value of an attribute within a DWARF debugging information entry: dwarf_attrval_flag, dwarf_attrval_signed, dwarf_attrval_string, and dwarf_attrval_unsigned. They're giving "let me fetch that attribute value for you" energy, and they ate. π
β¨ LIBRARY β¨
DWARF Access Library (libdwarf, -ldwarf). Link with -ldwarf, no cap.
π¦ SYNOPSIS π¦
#include <libdwarf.h>
int
dwarf_attrval_flag(Dwarf_Die die, Dwarf_Half attr, Dwarf_Bool *ret,
Dwarf_Error *err);
int
dwarf_attrval_signed(Dwarf_Die die, Dwarf_Half attr, Dwarf_Signed *ret,
Dwarf_Error *err);
int
dwarf_attrval_string(Dwarf_Die die, Dwarf_Half attr, const char **ret,
Dwarf_Error *err);
int
dwarf_attrval_unsigned(Dwarf_Die die, Dwarf_Half attr,
Dwarf_Unsigned *ret, Dwarf_Error *err);
πΈ DESCRIPTION πΈ
These functions search the debugging information entry referenced by argument die for the attribute named by argument attr. If the named attribute is found, the functions set the location pointed to by argument ret to the value of the attribute. The argument err, if non NULL, will be used to return an error descriptor in case of an error. bestie, that's the whole vibe: find the attr, stash the value, maybe stash an error.
Function dwarf_attrval_flag() sets the location pointed to by argument ret to either 0 or 1. If the form of the attribute named by argument attr is DW_FORM_flag, function dwarf_attrval_flag() sets the location pointed to by argument ret to 1 if the attribute has a non-zero value, or to 0 otherwise. If the form of the attribute named by argument attr is DW_FORM_flag_present, function dwarf_attrval_flag() unconditionally sets the location pointed to by argument ret to 1. The form of the attribute must be one of DW_FORM_flag or DW_FORM_flag_present. flag vibes: present means yes, periodt.
Function dwarf_attrval_signed() stores the value for the attribute named by argument attr, into the location pointed to by argument ret. The attribute's value is treated as a signed integral quantity and is sign-extended as needed. The attribute named by the argument attr must belong to the CONSTANT class and must have one of the following forms: DW_FORM_data1, DW_FORM_data2, DW_FORM_data4, DW_FORM_data8 or DW_FORM_sdata. signed, sealed, delivered, and sign-extended as needed π
Function dwarf_attrval_string() sets the location pointed to by argument ret to a pointer to a NUL-terminated string that is the value of the attribute named by argument attr. The form of the attribute must be one of DW_FORM_string or DW_FORM_strp. string moment: pointer to a NUL-terminated string, iconic.
Function dwarf_attrval_unsigned() stores the value for the attribute named by argument attr into the location pointed to by argument ret. The attribute's value is treated as an unsigned integral quantity, and is zero-extended as needed. The named attribute must belong to one of the CONSTANT, ADDRESS or REFERENCE classes and must have one of the following forms: DW_FORM_addr, DW_FORM_data1, DW_FORM_data2, DW_FORM_data4, DW_FORM_data8, DW_FORM_udata, DW_FORM_ref1, DW_FORM_ref2, DW_FORM_ref4, DW_FORM_ref8, or DW_FORM_ref_udata. unsigned and zero-extended, living its best life β¨
If the attribute named by argument attr is DW_AT_type and is not present in the debugging information entry referenced by argument die, and if a DW_AT_abstract_origin or DW_AT_specification attribute is present in the debugging information entry, function dwarf_attrval_unsigned() will search for the named attribute in the debugging information entry referenced by the DW_AT_abstract_origin or DW_AT_specification attribute. the way that dwarf_attrval_unsigned() goes on a little side quest for DW_AT_type β main character energy fr fr.
π RETURN VALUES π
On success, these functions return DW_DLV_OK. If the named attribute was not found in the specified debugging information entry descriptor these functions return DW_DLV_NO_ENTRY and set argument err. For other errors, these functions return DW_DLV_ERROR and set argument err. so: DW_DLV_OK = slay, DW_DLV_NO_ENTRY = not found bestie, DW_DLV_ERROR = something went sideways.
π COMPATIBILITY π
These functions are extensions added by this implementation of the DWARF(3) API. iykyk β this implementation added them, so don't assume every DWARF API ever has the same extra sparkle.
π₯ ERRORS π₯
These functions may fail with the following errors:
[DW_DLE_ARGUMENT]β Either of the argumentsdieorretwasNULL.[DW_DLE_NO_ENTRY]β Argumentdiedid not contain an attribute corresponding to the value in argumentattr.[DW_DLE_ATTR_FORM_BAD]β The attribute named by argumentattrwas not of a permitted form.
these are the three "check ur args and check ur forms" glow-up checkpoints π
π SEE ALSO π
okay bestie, that's the whole page! this cutie is from Debian, dated December 26, 2016, and it's the DWARF_ATTRVAL_SIGNED(3) manual page. mwah πβ¨π«Ά
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: libdwarf 15.0.0
- Copyright (c) 2011 Kai Wang
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms