libdwarf
Functions
Fast Access-Access to .debug_pubnames and more.

Pubnames and Pubtypes overview More...

Functions

int dwarf_get_globals (Dwarf_Debug dw_dbg, Dwarf_Global **dw_globals, Dwarf_Signed *dw_number_of_globals, Dwarf_Error *dw_error)
 Global name space operations, .debug_pubnames access. More...
 
void dwarf_globals_dealloc (Dwarf_Debug dw_dbg, Dwarf_Global *dw_globals, Dwarf_Signed dw_number_of_globals)
 Dealloc the Dwarf_Globals data. More...
 
int dwarf_globname (Dwarf_Global dw_global, char **dw_returned_name, Dwarf_Error *dw_error)
 Return the name of a global data item. More...
 
int dwarf_global_die_offset (Dwarf_Global dw_global, Dwarf_Off *dw_return_offset, Dwarf_Error *dw_error)
 Return the DIE offset of a global data item. More...
 
int dwarf_global_cu_offset (Dwarf_Global dw_global, Dwarf_Off *dw_return_offset, Dwarf_Error *dw_error)
 Return the CU header data of a global data item. More...
 
int dwarf_global_name_offsets (Dwarf_Global dw_global, char **dw_returned_name, Dwarf_Off *dw_die_offset, Dwarf_Off *dw_cu_offset, Dwarf_Error *dw_error)
 Return the name and offsets of a global entry. More...
 
int dwarf_get_globals_header (Dwarf_Global dw_global, Dwarf_Off *dw_offset_pub_header, Dwarf_Unsigned *dw_length_size, Dwarf_Unsigned *dw_length_pub, Dwarf_Unsigned *dw_version, Dwarf_Unsigned *dw_header_info_offset, Dwarf_Unsigned *dw_info_length, Dwarf_Error *dw_error)
 For more complete globals printing. For each CU represented in .debug_pubnames, etc, there is a .debug_pubnames header. For any given Dwarf_Global this returns the content of the applicable header.
 
int dwarf_get_pubtypes (Dwarf_Debug dw_dbg, Dwarf_Type **dw_types, Dwarf_Signed *dw_number_of_types, Dwarf_Error *dw_error)
 Access to DWARF3, DWARF4 .debug_pubtypes section. More...
 
void dwarf_pubtypes_dealloc (Dwarf_Debug dw_dbg, Dwarf_Type *dw_pubtypes, Dwarf_Signed dw_number_of_pubtypes)
 
int dwarf_pubtypename (Dwarf_Type dw_type, char **dw_returned_name, Dwarf_Error *dw_error)
 
int dwarf_pubtype_type_die_offset (Dwarf_Type dw_type, Dwarf_Off *dw_return_offset, Dwarf_Error *dw_error)
 
int dwarf_pubtype_cu_offset (Dwarf_Type dw_type, Dwarf_Off *dw_return_offset, Dwarf_Error *dw_error)
 
int dwarf_pubtype_name_offsets (Dwarf_Type dw_type, char **dw_returned_name, Dwarf_Off *dw_die_offset, Dwarf_Off *dw_cu_offset, Dwarf_Error *dw_error)
 
int dwarf_get_funcs (Dwarf_Debug dw_dbg, Dwarf_Func **dw_funcs, Dwarf_Signed *dw_number_of_funcs, Dwarf_Error *dw_error)
 Access to SGI/IRIX .debug_funcs section. Static function names and offsets. More...
 
void dwarf_funcs_dealloc (Dwarf_Debug dw_dbg, Dwarf_Func *dw_funcs, Dwarf_Signed dw_number_of_funcs)
 
int dwarf_funcname (Dwarf_Func dw_func, char **dw_returned_name, Dwarf_Error *dw_error)
 
int dwarf_func_die_offset (Dwarf_Func dw_func, Dwarf_Off *dw_return_offset, Dwarf_Error *dw_error)
 
int dwarf_func_cu_offset (Dwarf_Func dw_func, Dwarf_Off *dw_return_offset, Dwarf_Error *dw_error)
 
int dwarf_func_name_offsets (Dwarf_Func dw_func, char **dw_returned_name, Dwarf_Off *dw_die_offset, Dwarf_Off *dw_cu_offset, Dwarf_Error *dw_error)
 
int dwarf_get_types (Dwarf_Debug dw_dbg, Dwarf_Type **dw_types, Dwarf_Signed *dw_number_of_types, Dwarf_Error *dw_error)
 Access to SGI/IRIX .debug_types section. Static types names and offsets. Pubnames and Pubtypes overview . More...
 
void dwarf_types_dealloc (Dwarf_Debug dw_dbg, Dwarf_Type *dw_types, Dwarf_Signed dw_number_of_types)
 
int dwarf_typename (Dwarf_Type dw_type, char **dw_returned_name, Dwarf_Error *dw_error)
 
int dwarf_type_die_offset (Dwarf_Type dw_type, Dwarf_Off *dw_return_offset, Dwarf_Error *dw_error)
 
int dwarf_type_cu_offset (Dwarf_Type dw_type, Dwarf_Off *dw_return_offset, Dwarf_Error *dw_error)
 
int dwarf_type_name_offsets (Dwarf_Type dw_type, char **dw_returned_name, Dwarf_Off *dw_die_offset, Dwarf_Off *dw_cu_offset, Dwarf_Error *dw_error)
 
int dwarf_get_vars (Dwarf_Debug dw_dbg, Dwarf_Var **dw_vars, Dwarf_Signed *dw_number_of_vars, Dwarf_Error *dw_error)
 Access to SGI/IRIC .debug_vars section. File-scope static variable names Pubnames and Pubtypes overview . More...
 
void dwarf_vars_dealloc (Dwarf_Debug dw_dbg, Dwarf_Var *dw_vars, Dwarf_Signed dw_number_of_vars)
 
int dwarf_varname (Dwarf_Var dw_var, char **dw_returned_name, Dwarf_Error *dw_error)
 
int dwarf_var_die_offset (Dwarf_Var dw_var, Dwarf_Off *dw_return_offset, Dwarf_Error *dw_error)
 
int dwarf_var_cu_offset (Dwarf_Var dw_var, Dwarf_Off *dw_return_offset, Dwarf_Error *dw_error)
 
int dwarf_var_name_offsets (Dwarf_Var dw_var, char **dw_returned_name, Dwarf_Off *dw_die_offset, Dwarf_Off *dw_cu_offset, Dwarf_Error *dw_error)
 
int dwarf_get_weaks (Dwarf_Debug dw_dbg, Dwarf_Weak **dw_weaks, Dwarf_Signed *dw_number_of_weaks, Dwarf_Error *dw_error)
 Access to SGI/IRIC .debug_weaks section. More...
 
void dwarf_weaks_dealloc (Dwarf_Debug dw_dbg, Dwarf_Weak *dw_weaks, Dwarf_Signed dw_number_of_weaks)
 
int dwarf_weakname (Dwarf_Weak dw_weak, char **dw_returned_name, Dwarf_Error *dw_error)
 
int dwarf_weak_die_offset (Dwarf_Weak dw_weak, Dwarf_Off *dw_return_offset, Dwarf_Error *dw_error)
 
int dwarf_weak_cu_offset (Dwarf_Weak dw_weak, Dwarf_Off *dw_return_offset, Dwarf_Error *dw_error)
 
int dwarf_weak_name_offsets (Dwarf_Weak dw_weak, char **dw_returned_name, Dwarf_Off *dw_die_offset, Dwarf_Off *dw_cu_offset, Dwarf_Error *dw_error)
 
int dwarf_return_empty_pubnames (Dwarf_Debug dw_dbg, int dw_flag)
 A flag for dwarfdump on pubnames, pubtypes etc. More...
 

Detailed Description

Pubnames and Pubtypes overview

These functions each read one of a set of sections designed for fast access by name, but they are not always emitted as they each have somewhat limited and inflexible capabilities. So you may not see many of these.

All have the same set of functions with a name reflecting the specific object section involved. Only the first, of type Dwarf_Global, is documented here in full detail as the others do the same jobs just each for their applicable object section..

Function Documentation

◆ dwarf_get_globals()

int dwarf_get_globals ( Dwarf_Debug  dw_dbg,
Dwarf_Global **  dw_globals,
Dwarf_Signed dw_number_of_globals,
Dwarf_Error dw_error 
)

Global name space operations, .debug_pubnames access.

This section is defined in DWARF2, DWARF3, and DWARF4.

See also
Example of dwarf_get_globals use
Parameters
dw_dbgThe Dwarf_Debug of interest.
dw_globalsOn success returns an array of pointers to opaque structs..
dw_number_of_globalsOn success returns the number of entries in the array.
dw_errorOn error dw_error is set to point to the error details.
Returns
The usual value: DW_DLV_OK etc. Returns DW_DLV_NO_ENTRY if the section is not present.

◆ dwarf_globals_dealloc()

void dwarf_globals_dealloc ( Dwarf_Debug  dw_dbg,
Dwarf_Global dw_globals,
Dwarf_Signed  dw_number_of_globals 
)

Dealloc the Dwarf_Globals data.

Parameters
dw_dbgThe Dwarf_Debug of interest.
dw_globalsThe globals array data to dealloc (free).
dw_number_of_globalsThe number of entries in the array.

◆ dwarf_globname()

int dwarf_globname ( Dwarf_Global  dw_global,
char **  dw_returned_name,
Dwarf_Error dw_error 
)

Return the name of a global data item.

Parameters
dw_globalThe Dwarf_Debug of interest.
dw_returned_nameOn success a pointer to the name (a null-terminated string) is returned.
dw_errorOn error dw_error is set to point to the error details.
Returns
The usual value: DW_DLV_OK etc.

◆ dwarf_global_die_offset()

int dwarf_global_die_offset ( Dwarf_Global  dw_global,
Dwarf_Off dw_return_offset,
Dwarf_Error dw_error 
)

Return the DIE offset of a global data item.

Parameters
dw_globalThe Dwarf_Debug of interest.
dw_return_offsetOn success a the section-global DIE offset of a data item is returned.
dw_errorOn error dw_error is set to point to the error details.
Returns
The usual value: DW_DLV_OK etc.

◆ dwarf_global_cu_offset()

int dwarf_global_cu_offset ( Dwarf_Global  dw_global,
Dwarf_Off dw_return_offset,
Dwarf_Error dw_error 
)

Return the CU header data of a global data item.

Parameters
dw_globalThe Dwarf_Debug of interest.
dw_return_offsetOn success a the section-global offset of a CU header is returned.
dw_errorOn error dw_error is set to point to the error details.
Returns
The usual value: DW_DLV_OK etc.

◆ dwarf_global_name_offsets()

int dwarf_global_name_offsets ( Dwarf_Global  dw_global,
char **  dw_returned_name,
Dwarf_Off dw_die_offset,
Dwarf_Off dw_cu_offset,
Dwarf_Error dw_error 
)

Return the name and offsets of a global entry.

Parameters
dw_globalThe Dwarf_Debug of interest.
dw_returned_nameOn success a pointer to the name (a null-terminated string) is returned.
dw_die_offsetOn success a the section-global DIE offset of the global with the name.
dw_cu_offsetOn success a the section-global offset of a CU header is returned.
dw_errorOn error dw_error is set to point to the error details.
Returns
The usual value: DW_DLV_OK etc.

◆ dwarf_get_pubtypes()

int dwarf_get_pubtypes ( Dwarf_Debug  dw_dbg,
Dwarf_Type **  dw_types,
Dwarf_Signed dw_number_of_types,
Dwarf_Error dw_error 
)

Access to DWARF3, DWARF4 .debug_pubtypes section.

Pubnames and Pubtypes overview

See also
Example of dwarf_get_pubtypes use

◆ dwarf_get_funcs()

int dwarf_get_funcs ( Dwarf_Debug  dw_dbg,
Dwarf_Func **  dw_funcs,
Dwarf_Signed dw_number_of_funcs,
Dwarf_Error dw_error 
)

Access to SGI/IRIX .debug_funcs section. Static function names and offsets.

Pubnames and Pubtypes overview

See also
Example of dwarf_get_funcs use

◆ dwarf_get_types()

int dwarf_get_types ( Dwarf_Debug  dw_dbg,
Dwarf_Type **  dw_types,
Dwarf_Signed dw_number_of_types,
Dwarf_Error dw_error 
)

Access to SGI/IRIX .debug_types section. Static types names and offsets. Pubnames and Pubtypes overview .

See also
Example of dwarf_get_types use

◆ dwarf_get_vars()

int dwarf_get_vars ( Dwarf_Debug  dw_dbg,
Dwarf_Var **  dw_vars,
Dwarf_Signed dw_number_of_vars,
Dwarf_Error dw_error 
)

Access to SGI/IRIC .debug_vars section. File-scope static variable names Pubnames and Pubtypes overview .

See also
examplen

◆ dwarf_get_weaks()

int dwarf_get_weaks ( Dwarf_Debug  dw_dbg,
Dwarf_Weak **  dw_weaks,
Dwarf_Signed dw_number_of_weaks,
Dwarf_Error dw_error 
)

Access to SGI/IRIC .debug_weaks section.

Lists weak symbols. Weak symbols are an Elf Object Format feature.

Pubnames and Pubtypes overview

See also
Example of dwarf_get_weaks use
https://en.wikipedia.org/wiki/Weak_symbol

◆ dwarf_return_empty_pubnames()

int dwarf_return_empty_pubnames ( Dwarf_Debug  dw_dbg,
int  dw_flag 
)

A flag for dwarfdump on pubnames, pubtypes etc.

Sets a flag in the dbg. Always returns DW_DLV_OK. Applies to all the sections of this kind: pubnames, pubtypes, funcs, typenames,vars, weaks. Ensures empty content (meaning no offset/name tuples) for a CU shows up rather than being suppressed.

Pubnames and Pubtypes overview

Parameters
dw_dbgThe Dwarf_Debug of interest.
dw_flagMust be the value one.
Returns
Returns DW_DLV_OK. Always.