DWARF_GET_LOCLIST_ENTRY(3)
π DWARF_GET_LOCLIST_ENTRY(3) π
okay bestie, welcome to the Library Functions Manual side of the group chat π this page is all about grabbing a DWARF location list entry, and yes itβs giving very niche but very iconic energy. π¦
πΈ NAME πΈ
dwarf_get_loclist_entry β retrieve DWARF location list entry. Thatβs the whole assignment, no cap. π
π LIBRARY π
DWARF Access Library (libdwarf, -ldwarf) β¨ link it, love it, keep it close.
β¨ SYNOPSIS β¨
#include <libdwarf.h>
int
dwarf_get_loclist_entry(Dwarf_Debug dbg, Dwarf_Unsigned offset,
Dwarf_Addr *hipc, Dwarf_Addr *lopc, Dwarf_Ptr *data,
Dwarf_Unsigned *entry_len, Dwarf_Unsigned *next_entry,
Dwarf_Error *err);
π«Ά DESCRIPTION π«Ά
Function dwarf_get_loclist_entry() retrieves a location list entry from the DWARF section .debug_loc. Main character behavior tbh. π
dbgβ should reference a DWARF debug context allocated usingdwarf_init(3).offsetβ an offset, relative to the.debug_locsection, to the start of the desired location list entry.hipcβ should point to a location which will hold the offset, relative to the base address of the location list entry, of the highest program counter value for the entry.lopcβ heads up, the original DESCRIPTION literally sayslowpchere π it should point to a location which will hold the offset, relative to the base address of the location list entry, of the lowest program counter value for the entry.dataβ should point to a location which will be set to a pointer to the location list data.entry_lenβ should point to a location which will hold the length in bytes of the location list data returned in argumentdata.next_entryβ should point to a location which will hold the offset of the next location list entry.errβ if it is notNULL, it will be used to store error information in case of an error.
π₯ RETURN VALUES π₯
Function dwarf_get_loclist_entry() returns DW_DLV_OK when it succeeds. It returns DW_DLV_NO_ENTRY if there is no location list at the specified offset offset. In case of an error, it returns DW_DLV_ERROR and sets the argument err. slay, but also mind the error path bestie π
π EXAMPLES π
To iterate through all the location list entries in the .debug_loc section, use:
Dwarf_Debug dbg;
Dwarf_Unsigned off, len, next;
Dwarf_Addr hipc, lopc;
Dwarf_Ptr data;
Dwarf_Error de;
int ret;
off = 0;
while ((ret = dwarf_get_loclist_entry(dbg, off, &hipc, &lopc, &data,
&len, &next, &de)) == DW_DLV_OK) {
/* ... use loclist entry ... */
off = next;
}
if (ret == DW_DLV_ERROR)
warnx("dwarf_get_loclist_entry failed: %s", dwarf_errmsg(de));
π ERRORS π
Function dwarf_get_loclist_entry() can fail with:
[DW_DLE_ARGUMENT]β one of the argumentsdbg,hipc,lopc,data,entry_lenornext_entrywasNULL.[DW_DLE_NO_ENTRY]β there is no location list at the specifiedoffsetoffset.
π§ SEE ALSO π§
dwarf(3), dwarf_loclist(3), dwarf_loclist_from_expr(3), dwarf_loclist_from_expr_a(3), dwarf_loclist_n(3).
and thatβs the whole DWARF_GET_LOCLIST_ENTRY(3) page, bestie β from the Debian source, dated July 6, 2011 ππ«Άπ
π¦ 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