libdwarf
Functions
.debug_addr access: DWARF5

Functions

int dwarf_debug_addr_table (Dwarf_Debug dw_dbg, Dwarf_Unsigned dw_section_offset, Dwarf_Debug_Addr_Table *dw_table_header, Dwarf_Unsigned *dw_length, Dwarf_Half *dw_version, Dwarf_Small *dw_address_size, Dwarf_Unsigned *dw_at_addr_base, Dwarf_Unsigned *dw_entry_count, Dwarf_Unsigned *dw_next_table_offset, Dwarf_Error *dw_error)
 Return a .debug_addr table. More...
 
int dwarf_debug_addr_by_index (Dwarf_Debug_Addr_Table dw_dat, Dwarf_Unsigned dw_entry_index, Dwarf_Unsigned *dw_address, Dwarf_Error *dw_error)
 Return .debug_addr address given table index. More...
 
void dwarf_dealloc_debug_addr_table (Dwarf_Debug_Addr_Table dw_dat)
 dealloc (free) a Dwarf_Attr_Table record. More...
 

Detailed Description

Reading just the .debug_addr section.

These functions solely useful for reading that section. It seems unlikely you would have a reason to call these. The functions getting attribute values use the section when appropriate without using these functions.

Function Documentation

◆ dwarf_debug_addr_table()

int dwarf_debug_addr_table ( Dwarf_Debug  dw_dbg,
Dwarf_Unsigned  dw_section_offset,
Dwarf_Debug_Addr_Table dw_table_header,
Dwarf_Unsigned dw_length,
Dwarf_Half dw_version,
Dwarf_Small dw_address_size,
Dwarf_Unsigned dw_at_addr_base,
Dwarf_Unsigned dw_entry_count,
Dwarf_Unsigned dw_next_table_offset,
Dwarf_Error dw_error 
)

Allocates and returns a pointer to a Dwarf_Debug_Addr_Table as well as the contents of the record.

Other than dw_debug and dw_error and dw_table_header a NULL passed in as a pointer argument means the return value will not be set through the pointer, so a caller can pass NULL for return values of no immediate interest.

It is only intended to enable printing of the simple DWARF5 .debug_addr section (by dwarfdump).

When emitting DWARF4, gcc may emit a GNU-specified .debug_addr format. If some CU has been opened then this call will work, but the single table will have all the entries for all CUs.

Parameters
dw_dbgThe Dwarf_Debug of interest.
dw_section_offsetPass in the section offset of a table header. Start with zero. If the passed-in offset is past the last byte of the table the function returns DW_DLV_NO_ENTRY.
dw_table_headerOn success Returns a pointer to a Dwarf_Debug_Addr_Table for use with dwarf_get_attr_by_index().
dw_lengthOn success Returns the length in bytes of this contribution to .debug_addr from the table header, including the table length field and the array of addresses.
dw_versionOn success returns the version number, which should be 5.
dw_address_sizeOn success returns the address size of the address entries in this table.
dw_at_addr_baseOn success returns the value that will appear in some DW_AT_addr_base attribute.
dw_entry_countOn success returns the number of table entries in this table instance.
dw_next_table_offsetOn success returns the offset of the next table in the section. Use the offset returned in the next call to this function.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc. If the dw_section_offset passed in is out of range it returns DW_DLV_NO_ENTRY. If it returns DW_DLV_ERROR only dw_error is set, none of the other return values are set through the pointers.

◆ dwarf_debug_addr_by_index()

int dwarf_debug_addr_by_index ( Dwarf_Debug_Addr_Table  dw_dat,
Dwarf_Unsigned  dw_entry_index,
Dwarf_Unsigned dw_address,
Dwarf_Error dw_error 
)
Parameters
dw_datPass in a Dwarf_Debug_Addr_Table pointer.
dw_entry_indexPass in a Dwarf_Debug_Addr_Table index to an address. If out of the valid range 0 through dw_entry_count-1 the function returns DW_DLV_NO_ENTRY.
dw_addressReturns an address in the program through the pointer.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc. If the dw_section_offset passed in is out of range it returns DW_DLV_NO_ENTRY. If it returns DW_DLV_ERROR only dw_error is set, dw_address is not set.

◆ dwarf_dealloc_debug_addr_table()

void dwarf_dealloc_debug_addr_table ( Dwarf_Debug_Addr_Table  dw_dat)
Parameters
dw_datPass in a valid Dwarf_Debug_Addr_Table pointer. Does nothing if the dw_dat field is NULL.