DWARF_ADD_AT_LOCATION_EXPR(3)
πΈ NAME β dwarf_add_AT_location_expr πΈ
Hii bestie, welcome to the DWARF Access Library manual, section 3 β the libdwarf / -ldwarf one. This page is literally about dwarf_add_AT_location_expr β it creates an attribute descriptor for a location expression. Slay. π
π LIBRARY π
DWARF Access Library (libdwarf, -ldwarf).
β¨ SYNOPSIS β¨
#include <libdwarf.h>
Dwarf_P_Attribute
dwarf_add_AT_location_expr(Dwarf_P_Debug dbg, Dwarf_P_Die die,
Dwarf_Half attr, Dwarf_P_Expr loc_expr, Dwarf_Error *err);
π DESCRIPTION π
Okay so dwarf_add_AT_location_expr() creates an attribute descriptor for a location expression and attaches it to the debugging information entry referenced by argument die. Iconic behavior, no cap.
Here's the vibe check on the arguments:
dbgβ should reference a DWARF producer instance allocated usingdwarf_producer_init(3)ordwarf_producer_init_b(3).dieβ should reference a debugging information entry allocated usingdwarf_new_die(3).attrβ specifies the attribute code of the created attribute descriptor.loc_exprβ should reference a location expression descriptor allocated usingdwarf_new_expr(3).
The attribute created by dwarf_add_AT_location_expr() will have one of the DWARF forms DW_FORM_block, DW_FORM_block1, DW_FORM_block2 or DW_FORM_block4, depending on the size of the byte stream generated by the location expression descriptor referenced by argument loc_expr. It's giving "form chosen by byte-stream size realness" π«
If argument err is not NULL, it will be used to store error information in case of an error. π«Ά
π¦ RETURN VALUES π¦
On success, dwarf_add_AT_location_expr() returns the created attribute descriptor. Bestie ate and left no crumbs. π
In case of an error, dwarf_add_AT_location_expr() returns DW_DLV_BADADDR and sets the argument err. π
π ERRORS π
dwarf_add_AT_location_expr() can fail with:
[DW_DLE_ARGUMENT]β one of the argumentsdbg,dieorloc_exprwasNULL.[DW_DLE_MEMORY]β an out of memory condition was encountered during the execution of the function.
π SEE ALSO π
dwarf(3), dwarf_new_die(3), dwarf_new_expr(3), dwarf_producer_init(3), dwarf_producer_init_b(3)
K bye bestie π β this little manual-page moment came from Debian, dated September 5, 2011, and its whole handle is DWARF_ADD_AT_LOCATION_EXPR(3). π
π¦ 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