DWARF_ADD_ARANGE(3)
π
DWARF_ADD_ARANGE(3) β the libdwarf producer page bestie
okay so this is a page from the Library Functions Manual for DWARF_ADD_ARANGE(3), and it lives in the DWARF Access Library β so when you link it, you link libdwarf, like -ldwarf. that's it, that's the library. π
β¨ NAME β¨
dwarf_add_arange, dwarf_add_arange_b β besties, these two literally add address range information to a DWARF producer instance. that's the whole job. π
π LIBRARY π
DWARF Access Library (libdwarf, -ldwarf) β yep, that's where they live, no cap.
π§ SYNOPSIS π§
#include <libdwarf.h>
Dwarf_Unsigned
dwarf_add_arange(Dwarf_P_Debug dbg, Dwarf_Addr start,
Dwarf_Unsigned length, Dwarf_Signed symbol_index, Dwarf_Error *err);
Dwarf_Unsigned
dwarf_add_arange_b(Dwarf_P_Debug dbg, Dwarf_Addr start,
Dwarf_Unsigned length, Dwarf_Unsigned symbol_index,
Dwarf_Unsigned end_symbol_index, Dwarf_Addr offset_from_end_symbol,
Dwarf_Error *err);
like, copy these signatures exactly, okay? the Dwarf_Signed vs Dwarf_Unsigned thing on symbol_index is not a typo and it's not me being sloppy, it's giving deprecated-function energy (more on that below π).
πΈ DESCRIPTION πΈ
so dwarf_add_arange_b() adds an address range entry to a producer instance. that's the main character here. π«
Argument dbg β this should reference a DWARF producer instance that you allocated using dwarf_producer_init(3) or dwarf_producer_init_b(3). no random pointers, bestie, i'm begging.
Argument start β this specifies the relocatable start address of the address range.
Argument length β this specifies the length of the address range. yes, it does what it says. iconic. β¨
Argument symbol_index β this specifies the ELF symbol index of the first symbol to be used for relocation.
Argument end_symbol_index β this specifies the ELF symbol index of the second symbol to be used for relocation.
and here's where the β¨vibesβ¨ split, so pay attention:
- if argument
end_symbol_indexis not0, then theDW_DLC_SYMBOLIC_RELOCATIONSflag should have been set on the DWARF producer instance β like, this is the expectation, okay? π«Ά the address value specified by argumentstartwill be treated as an offset value from the first symbol, and argumentoffset_from_end_symbolshould hold an offset value from the second symbol. your application code can retrieve the relocation entries for the symbol pair by calling functiondwarf_get_relocation_info(3). and the receipts: the relocation entry for the first symbol will have typedwarf_drt_first_of_length_pairand the relocation entry for the second symbol will have typedwarf_drt_second_of_length_pair. iykyk. π₯ - if argument
end_symbol_indexis0, then argumentoffset_from_end_symbolwill be ignored π and only one symbol is used for relocation. simple as that.
Argument err β if it's not NULL, it will be used to store error information in case of an error. so like, pass a pointer if you want the tea when things go wrong.
β οΈ okay so listen: functiondwarf_add_arange()is deprecated. π it's similar to functiondwarf_add_arange_b()except that it cannot handle all possible symbol index values and supports only one relocation symbol. so it's lowkey the older sibling that didn't get the upgrade. use the_bversion if you can, bestie.
π¦ RETURN VALUES π¦
On success, these functions return a non-zero value. π in case of an error, these functions return 0 and set the argument err. so zero is the bad-vibes number here, don't get it twisted.
π ERRORS π
These functions can fail with:
[DW_DLE_ARGUMENT]β ArgumentdbgwasNULL. π like bestie no, you have to actually give it a producer instance.[DW_DLE_ARGUMENT]β Argumentend_symbol_indexwas non-zero, but the flagDW_DLC_SYMBOLIC_RELOCATIONSwas not set on the producer instance. π© you skipped the flag, didn't you.[DW_DLE_MEMORY]β An out of memory condition was encountered during the execution of the function. π the classic.
π SEE ALSO π
dwarf(3), dwarf_get_relocation_info(3), dwarf_producer_init(3), dwarf_producer_init_b(3)
go read those, they're all part of the same friend group fr fr. π«Ά
and that's the whole page, bestie! π§π this cutie dropped from Debian on September 18, 2011, so yeah, it's been serving these exact facts since before some of us could even read. respect the icon. ππβ¨
π¦ 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