libdwarf
Functions
Abbreviations Section Details

Functions

int dwarf_get_abbrev (Dwarf_Debug dw_dbg, Dwarf_Unsigned dw_offset, Dwarf_Abbrev *dw_returned_abbrev, Dwarf_Unsigned *dw_length, Dwarf_Unsigned *dw_attr_count, Dwarf_Error *dw_error)
 Reading Abbreviation Data. More...
 
int dwarf_get_abbrev_tag (Dwarf_Abbrev dw_abbrev, Dwarf_Half *dw_return_tag_number, Dwarf_Error *dw_error)
 Get abbreviation tag. More...
 
int dwarf_get_abbrev_code (Dwarf_Abbrev dw_abbrev, Dwarf_Unsigned *dw_return_code_number, Dwarf_Error *dw_error)
 Get Abbreviation Code. More...
 
int dwarf_get_abbrev_children_flag (Dwarf_Abbrev dw_abbrev, Dwarf_Signed *dw_return_flag, Dwarf_Error *dw_error)
 Get Abbrev Children Flag. More...
 
int dwarf_get_abbrev_entry_b (Dwarf_Abbrev dw_abbrev, Dwarf_Unsigned dw_indx, Dwarf_Bool dw_filter_outliers, Dwarf_Unsigned *dw_returned_attr_num, Dwarf_Unsigned *dw_returned_form, Dwarf_Signed *dw_returned_implicit_const, Dwarf_Off *dw_offset, Dwarf_Error *dw_error)
 Get Abbrev Entry Details. More...
 

Detailed Description

Allows reading section .debug_abbrev independently of CUs or DIEs. Normally not done (libdwarf uses it as necessary to access DWARF DIEs and DWARF attributes) unless one is interested in the content of the section.

About Reading Independently.

Function Documentation

◆ dwarf_get_abbrev()

int dwarf_get_abbrev ( Dwarf_Debug  dw_dbg,
Dwarf_Unsigned  dw_offset,
Dwarf_Abbrev dw_returned_abbrev,
Dwarf_Unsigned dw_length,
Dwarf_Unsigned dw_attr_count,
Dwarf_Error dw_error 
)

Normally you never need to call these functions. Calls that involve DIEs do all this for you behind the scenes in the library.

This reads the data for a single abbrev code starting at dw_offset. Essentially, opening access to an abbreviation entry.

When libdwarf itself reads abbreviations to access DIEs the offset comes from the Compilation Unit Header debug_abbrev_offset field.

See also
dwarf_next_cu_header_d
Parameters
dw_dbgThe Dwarf_Debug of interest.
dw_offsetPass in the offset where a Debug_Abbrev starts.
dw_returned_abbrevOn success, sets a pointer to a Dwarf_Abbrev through the pointer to allow further access.
dw_lengthOn success, returns the length of the entire abbreviation block (bytes), useful to calculate the next offset if reading the section independently of any compilation unit.
dw_attr_countOn success, returns the number of attributes in this abbreviation entry.
dw_errorOn error dw_error is set to point to the error details.
Returns
The usual value: DW_DLV_OK etc. If the abbreviation is a single zero byte it is a null abbreviation. DW_DLV_OK is returned.

Close the abbrev by calling dwarf_dealloc(dbg,*dw_returned_abbrev, DW_DLA_ABBREV)

◆ dwarf_get_abbrev_tag()

int dwarf_get_abbrev_tag ( Dwarf_Abbrev  dw_abbrev,
Dwarf_Half dw_return_tag_number,
Dwarf_Error dw_error 
)
Parameters
dw_abbrevThe Dwarf_Abbrev of interest.
dw_return_tag_numberReturns the tag value, for example DW_TAG_compile_unit.
dw_errorOn error dw_error is set to point to the error details.
Returns
The usual value: DW_DLV_OK etc.

◆ dwarf_get_abbrev_code()

int dwarf_get_abbrev_code ( Dwarf_Abbrev  dw_abbrev,
Dwarf_Unsigned dw_return_code_number,
Dwarf_Error dw_error 
)
Parameters
dw_abbrevThe Dwarf_Abbrev of interest.
dw_return_code_numberReturns the code for this abbreviation, a number assigned to the abbreviation and unique within the applicable CU.
dw_errorOn error dw_error is set to point to the error details.
Returns
The usual value: DW_DLV_OK etc.

◆ dwarf_get_abbrev_children_flag()

int dwarf_get_abbrev_children_flag ( Dwarf_Abbrev  dw_abbrev,
Dwarf_Signed dw_return_flag,
Dwarf_Error dw_error 
)
Parameters
dw_abbrevThe Dwarf_Abbrev of interest.
dw_return_flagOn success returns the flag TRUE (greater than zero) if the DIE referencing the abbreviation has children, else returns FALSE (zero).
dw_errorOn error dw_error is set to point to the error details.
Returns
The usual value: DW_DLV_OK etc.

◆ dwarf_get_abbrev_entry_b()

int dwarf_get_abbrev_entry_b ( Dwarf_Abbrev  dw_abbrev,
Dwarf_Unsigned  dw_indx,
Dwarf_Bool  dw_filter_outliers,
Dwarf_Unsigned dw_returned_attr_num,
Dwarf_Unsigned dw_returned_form,
Dwarf_Signed dw_returned_implicit_const,
Dwarf_Off dw_offset,
Dwarf_Error dw_error 
)

Most will will call with filter_outliers non-zero.

Parameters
dw_abbrevThe Dwarf_Abbrev of interest.
dw_indxValid dw_index values are 0 through dw_attr_count-1
dw_filter_outliersPass non-zero (TRUE) so the function will check for unreasonable abbreviation content and return DW_DLV_ERROR if such found. If zero (FALSE) passed in even a nonsensical attribute number and/or unknown DW_FORM are allowed (used by dwarfdump to report the issue(s)).
dw_returned_attr_numOn success returns the attribute number, such as DW_AT_name
dw_returned_formOn success returns the attribute FORM, such as DW_FORM_udata
dw_returned_implicit_constOn success, if the dw_returned_form is DW_FORM_implicit_const then dw_returned_implicit_const is the implicit const value, but if not implicit const the return value is zero..
dw_offsetOn success returns the offset of the start of this attr/form pair in the abbreviation section.
dw_errorOn error dw_error is set to point to the error details.
Returns
The usual value: DW_DLV_OK etc. If the abbreviation code for this Dwarf_Abbrev is 0 it is a null abbreviation, the dw_indx is ignored, and the function returns DW_DLV_NO_ENTRY.