DWARF_GET_GLOBALS(3)
π DWARF_GET_GLOBALS(3) β global object info, bestie edition π
okay so this is the Library Functions Manual page for DWARF_GET_GLOBALS(3), and it's literally all about pulling info on global objects out of DWARF. no cap, it's niche but iconic. π«Ά
πΈ NAME πΈ
dwarf_get_globals, dwarf_global_cu_offset, dwarf_global_die_offset, dwarf_global_name_offsets, dwarf_globname β retrieve information about global objects
π¦ LIBRARY π¦
DWARF Access Library (libdwarf, -ldwarf)
β¨ SYNOPSIS β¨
#include <libdwarf.h>
int
dwarf_get_globals(Dwarf_Debug dbg, Dwarf_Global **globals,
Dwarf_Signed *nglobals, Dwarf_Error *err);
int
dwarf_global_cu_offset(Dwarf_Global global, Dwarf_Off *cu_offset,
Dwarf_Error *err);
int
dwarf_global_die_offset(Dwarf_Global global, Dwarf_Off *die_offset,
Dwarf_Error *err);
int
dwarf_global_name_offsets(Dwarf_Global global, char **name,
Dwarf_Off *die_offset, Dwarf_Off *cu_die_offset, Dwarf_Error *err);
int
dwarf_globname(Dwarf_Global global, char **name, Dwarf_Error *err);
π DESCRIPTION π
These functions retrieve information about global symbols from the lookup tables in the .debug_pubnames DWARF section. That info comes back using opaque descriptors of type Dwarf_Global. Applications need to use the functions described below to retrieve the name and the offsets for these descriptors. iykyk π
dwarf_get_globals() β okay so this one retrieves descriptors for all the global symbols associated with the DWARF debug context specified by argument dbg. The argument globals should point to a location that will be set to a pointer to an array of Dwarf_Global descriptors. The argument nglobals should point to a location that will be set to the number of descriptors returned. slay. β¨
dwarf_global_cu_offset() β this returns the section-relative offset, relative to the .debug_info section, of the compilation unit that contains the debugging information entry associated with the argument global. Argument cu_offset should point to a location that will hold the returned offset.
dwarf_global_die_offset() β retrieves the section-relative offset, relative to the .debug_info section, of the debugging information entry associated with the argument global, and stores it into the location pointed to by the argument die_offset.
dwarf_global_name_offsets() β retrieves the name and the offsets for the debugging information entry for argument global. Argument name should point to a location which will be set to a pointer to a NUL-terminated string containing the name of the associated debugging information entry. Argument die_offset should point to a location which will be set to a section-relative offset, relative to the .debug_info section, of the associated debugging information entry. Argument cu_die_offset should point to a location which will be set to a section-relative offset, relative to the .debug_info section, of the first debugging information entry in the compilation unit associated with argument global. that's a lot of offsets, but we move. π¦
dwarf_globname() β sets the location pointed to by argument name to a pointer to a NUL-terminated string holding the name of the debugging information entry associated with the argument global.
π§ Memory Management π§
bestie, ownership matters. The memory area used for the array of Dwarf_Global descriptors returned in argument globals by function dwarf_get_globals() is owned by the DWARF Access Library (libdwarf, -ldwarf). Application code should not attempt to directly free this pointer. Portable code should instead use the function dwarf_globals_dealloc(3) to indicate that the memory area may be freed. no double-free chaos, please. π
The memory area used for the string returned in the name argument to functions dwarf_globname() and dwarf_global_name_offsets() is owned by the DWARF Access Library (libdwarf, -ldwarf). Portable code should use the dwarf_dealloc(3) function to indicate that the memory area may be freed.
π¨ Error Returns π¨
If argument err is not NULL, these functions will use it to store error information, in case of an error. very main character energy of err, honestly. π
π RETURN VALUES π
On success, these functions return DW_DLV_OK. In case of an error, they return DW_DLV_ERROR and set the argument err.
π₯ ERRORS π₯
These functions may fail with the following errors:
[DW_DLE_ARGUMENT]β one of the argumentscu_die_offset,cu_offset,dbg,die_offset,global,globals,name, ornglobalswasNULL.
π SEE ALSO π
dwarf(3)dwarf_dealloc(3)dwarf_get_cu_die_offset_given_cu_header_offset(3)dwarf_globals_dealloc(3)
π that's the whole page, bestie! source/version: Debian; date: April 2, 2011; page: DWARF_GET_GLOBALS(3). 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