libdwarf
Loading...
Searching...
No Matches
Functions
Debugging Information Entry (DIE) content

Functions

DW_API int dwarf_die_abbrev_global_offset (Dwarf_Die dw_die, Dwarf_Off *dw_abbrev_offset, Dwarf_Unsigned *dw_abbrev_count, Dwarf_Error *dw_error)
 Return the abbrev section offset of a DIE's abbrevs.
 
DW_API int dwarf_tag (Dwarf_Die dw_die, Dwarf_Half *dw_return_tag, Dwarf_Error *dw_error)
 Get TAG value of DIE.
 
DW_API int dwarf_dieoffset (Dwarf_Die dw_die, Dwarf_Off *dw_return_offset, Dwarf_Error *dw_error)
 Return the global section offset of the DIE.
 
DW_API int dwarf_debug_addr_index_to_addr (Dwarf_Die dw_die, Dwarf_Unsigned dw_index, Dwarf_Addr *dw_return_addr, Dwarf_Error *dw_error)
 Extract address given address index. DWARF5.
 
DW_API Dwarf_Bool dwarf_addr_form_is_indexed (int dw_form)
 Informs if a DW_FORM is an indexed form.
 
DW_API int dwarf_CU_dieoffset_given_die (Dwarf_Die dw_die, Dwarf_Off *dw_return_offset, Dwarf_Error *dw_error)
 Return the CU DIE offset given any DIE.
 
DW_API int dwarf_get_cu_die_offset_given_cu_header_offset_b (Dwarf_Debug dw_dbg, Dwarf_Off dw_in_cu_header_offset, Dwarf_Bool dw_is_info, Dwarf_Off *dw_out_cu_die_offset, Dwarf_Error *dw_error)
 Return the CU DIE section offset given CU header offset.
 
DW_API int dwarf_die_CU_offset (Dwarf_Die dw_die, Dwarf_Off *dw_return_offset, Dwarf_Error *dw_error)
 returns the CU relative offset of the DIE.
 
DW_API int dwarf_die_CU_offset_range (Dwarf_Die dw_die, Dwarf_Off *dw_return_CU_header_offset, Dwarf_Off *dw_return_CU_length_bytes, Dwarf_Error *dw_error)
 Return the offset length of the entire CU of a DIE.
 
DW_API int dwarf_attr (Dwarf_Die dw_die, Dwarf_Half dw_attrnum, Dwarf_Attribute *dw_returned_attr, Dwarf_Error *dw_error)
 Given DIE and attribute number return a Dwarf_attribute.
 
DW_API int dwarf_die_text (Dwarf_Die dw_die, Dwarf_Half dw_attrnum, char **dw_ret_name, Dwarf_Error *dw_error)
 Given DIE and attribute number return a string.
 
DW_API int dwarf_diename (Dwarf_Die dw_die, char **dw_diename, Dwarf_Error *dw_error)
 Return the string from a DW_AT_name attribute.
 
DW_API Dwarf_Unsigned dwarf_die_abbrev_code (Dwarf_Die dw_die)
 Return the DIE abbrev code.
 
DW_API int dwarf_die_abbrev_children_flag (Dwarf_Die dw_die, Dwarf_Half *dw_ab_has_child)
 Return TRUE if the DIE has children.
 
DW_API int dwarf_validate_die_sibling (Dwarf_Die dw_sibling, Dwarf_Off *dw_offset)
 Validate a sibling DIE.
 
DW_API int dwarf_hasattr (Dwarf_Die dw_die, Dwarf_Half dw_attrnum, Dwarf_Bool *dw_returned_bool, Dwarf_Error *dw_error)
 Tells whether a DIE has a particular attribute.
 
DW_API int dwarf_offset_list (Dwarf_Debug dw_dbg, Dwarf_Off dw_offset, Dwarf_Bool dw_is_info, Dwarf_Off **dw_offbuf, Dwarf_Unsigned *dw_offcount, Dwarf_Error *dw_error)
 Return an array of DIE children offsets.
 
DW_API int dwarf_get_die_address_size (Dwarf_Die dw_die, Dwarf_Half *dw_addr_size, Dwarf_Error *dw_error)
 Get the address size applying to a DIE.
 
DW_API int dwarf_die_offsets (Dwarf_Die dw_die, Dwarf_Off *dw_global_offset, Dwarf_Off *dw_local_offset, Dwarf_Error *dw_error)
 Return section and CU-local offsets of a DIE.
 
DW_API int dwarf_get_version_of_die (Dwarf_Die dw_die, Dwarf_Half *dw_version, Dwarf_Half *dw_offset_size)
 Get the version and offset size.
 
DW_API int dwarf_lowpc (Dwarf_Die dw_die, Dwarf_Addr *dw_returned_addr, Dwarf_Error *dw_error)
 Return the DW_AT_low_pc value.
 
DW_API int dwarf_highpc_b (Dwarf_Die dw_die, Dwarf_Addr *dw_return_addr, Dwarf_Half *dw_return_form, enum Dwarf_Form_Class *dw_return_class, Dwarf_Error *dw_error)
 Return the DW_AT_hipc address value.
 
DW_API int dwarf_dietype_offset (Dwarf_Die dw_die, Dwarf_Off *dw_return_offset, Dwarf_Bool *dw_is_info, Dwarf_Error *dw_error)
 Return the offset from the DW_AT_type attribute.
 
DW_API int dwarf_bytesize (Dwarf_Die dw_die, Dwarf_Unsigned *dw_returned_size, Dwarf_Error *dw_error)
 Return the value of the attribute DW_AT_byte_size.
 
DW_API int dwarf_bitsize (Dwarf_Die dw_die, Dwarf_Unsigned *dw_returned_size, Dwarf_Error *dw_error)
 Return the value of the attribute DW_AT_bitsize.
 
DW_API int dwarf_bitoffset (Dwarf_Die dw_die, Dwarf_Half *dw_attrnum, Dwarf_Unsigned *dw_returned_offset, Dwarf_Error *dw_error)
 Return the bit offset attribute of a DIE.
 
DW_API int dwarf_srclang (Dwarf_Die dw_die, Dwarf_Unsigned *dw_returned_lang, Dwarf_Error *dw_error)
 Return the value of the DW_AT_language attribute.
 
DW_API int dwarf_srclanglname (Dwarf_Die dw_die, Dwarf_Unsigned *dw_returned_lname, Dwarf_Error *dw_error)
 Return the value of the DW_AT_language_name attribute.
 
DW_API int dwarf_srclanglname_version (Dwarf_Die dw_die, const char *dw_returned_verstring, Dwarf_Error *dw_error)
 Return the value of the DW_AT_language_version attribute.
 
DW_API int dwarf_language_version_data (Dwarf_Unsigned dw_lname_name, int *dw_default_lower_bound, const char **dw_version_string)
 Return values associated with DW_AT_language_name.
 
DW_API int dwarf_language_version_string (Dwarf_Unsigned dw_lname_name, int *dw_default_lower_bound, const char **dw_version_string)
 dwarf_language_version_string is obsolete.
 
DW_API int dwarf_lvn_name_direct (Dwarf_Unsigned dw_lv_lang, Dwarf_Unsigned dw_lv_ver, const char **dw_ret_version_name, const char **dw_ret_version_scheme)
 Return language version name.
 
DW_API int dwarf_lvn_name (Dwarf_Die dw_die, const char **dw_ret_version_name, const char **dw_ret_version_scheme)
 Return values associated with DW_AT_language_version.
 
DW_API int dwarf_lvn_table_entry (Dwarf_Unsigned dw_lvn_index, Dwarf_Unsigned *dw_lvn_language_name, Dwarf_Unsigned *dw_lvn_language_version, const char **dw_lvn_language_version_scheme, const char **dw_lvn_language_version_name)
 Return values from the DWARF6 language version standard.
 
DW_API int dwarf_arrayorder (Dwarf_Die dw_die, Dwarf_Unsigned *dw_returned_order, Dwarf_Error *dw_error)
 Return the value of the DW_AT_ordering attribute.
 

Detailed Description

This is the main interface to attributes of a DIE.

Function Documentation

◆ dwarf_addr_form_is_indexed()

DW_API Dwarf_Bool dwarf_addr_form_is_indexed ( int  dw_form)

Informs if a DW_FORM is an indexed form.

Reading a CU DIE with DW_AT_low_pc an indexed value can be problematic as several different FORMs are indexed. Some in DWARF5 others being extensions to DWARF4 and DWARF5. Indexed forms interact with DW_AT_addr_base in a DIE making this a very relevant distinction.

◆ dwarf_arrayorder()

DW_API int dwarf_arrayorder ( Dwarf_Die  dw_die,
Dwarf_Unsigned dw_returned_order,
Dwarf_Error dw_error 
)

Return the value of the DW_AT_ordering attribute.

Parameters
dw_dieThe DIE of interest.
dw_returned_orderOn success returns the ordering value. For example DW_ORD_row_major
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_attr()

DW_API int dwarf_attr ( Dwarf_Die  dw_die,
Dwarf_Half  dw_attrnum,
Dwarf_Attribute dw_returned_attr,
Dwarf_Error dw_error 
)

Given DIE and attribute number return a Dwarf_attribute.

Returns DW_DLV_NO_ENTRY if the DIE has no attribute dw_attrnum.

Parameters
dw_dieThe DIE of interest.
dw_attrnumAn attribute number, for example DW_AT_name.
dw_returned_attrOn success a Dwarf_Attribute pointer is returned and it should eventually be deallocated.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_bitoffset()

DW_API int dwarf_bitoffset ( Dwarf_Die  dw_die,
Dwarf_Half dw_attrnum,
Dwarf_Unsigned dw_returned_offset,
Dwarf_Error dw_error 
)

Return the bit offset attribute of a DIE.

If the attribute is DW_AT_data_bit_offset (DWARF4, DWARF5) the returned bit offset has one meaning. If the attribute is DW_AT_bit_offset (DWARF2, DWARF3) the meaning is quite different.

Parameters
dw_dieThe DIE of interest.
dw_attrnumIf successful, returns the number of the attribute (DW_AT_data_bit_offset or DW_AT_bit_offset)
dw_returned_offsetIf successful, returns the bit offset value.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_bitsize()

DW_API int dwarf_bitsize ( Dwarf_Die  dw_die,
Dwarf_Unsigned dw_returned_size,
Dwarf_Error dw_error 
)

Return the value of the attribute DW_AT_bitsize.

Parameters
dw_dieThe DIE of interest.
dw_returned_sizeIf successful, returns the size through the pointer.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_bytesize()

DW_API int dwarf_bytesize ( Dwarf_Die  dw_die,
Dwarf_Unsigned dw_returned_size,
Dwarf_Error dw_error 
)

Return the value of the attribute DW_AT_byte_size.

Parameters
dw_dieThe DIE of interest.
dw_returned_sizeIf successful, returns the size through the pointer.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_CU_dieoffset_given_die()

DW_API int dwarf_CU_dieoffset_given_die ( Dwarf_Die  dw_die,
Dwarf_Off dw_return_offset,
Dwarf_Error dw_error 
)

Return the CU DIE offset given any DIE.

Returns the global debug_info section offset of the CU DIE in the CU containing the given_die (the passed in DIE can be any DIE).

This does not identify whether the section is .debug_info or .debug_types, use dwarf_get_die_infotypes_flag() to determine the section.

See also
dwarf_get_cu_die_offset_given_cu_header_offset_b
Using dwarf_offset_given_die()
Parameters
dw_dieThe DIE being queried.
dw_return_offsetReturns the section offset of the CU DIE for dw_die.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_debug_addr_index_to_addr()

DW_API int dwarf_debug_addr_index_to_addr ( Dwarf_Die  dw_die,
Dwarf_Unsigned  dw_index,
Dwarf_Addr dw_return_addr,
Dwarf_Error dw_error 
)

Extract address given address index. DWARF5.

Useful for checking for compiler/linker errors in the creation of DWARF5.

Parameters
dw_dieThe DIE of interest
dw_indexAn index into .debug_addr. This will look first for .debug_addr in the dbg object DIE and if not there will look in the tied object if that is available.
dw_return_addrOn success the address is returned through the pointer.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_die_abbrev_children_flag()

DW_API int dwarf_die_abbrev_children_flag ( Dwarf_Die  dw_die,
Dwarf_Half dw_ab_has_child 
)

Return TRUE if the DIE has children.

Parameters
dw_dieA valid DIE pointer (not NULL).
dw_ab_has_childSets TRUE though the pointer if the DIE has children. Otherwise sets FALSE.
Returns
Returns TRUE if the DIE has a child DIE. Else returns FALSE.

◆ dwarf_die_abbrev_code()

DW_API Dwarf_Unsigned dwarf_die_abbrev_code ( Dwarf_Die  dw_die)

Return the DIE abbrev code.

The Abbrev code for a DIE is a positive integer assigned by the compiler within a particular CU. For .debug_names abbreviations the situation is conceptually similar. The code values are arbitrary but compilers are motivated to make them small so the object size is as small as possible.

Returns the abbrev code of the die. Cannot fail.

Parameters
dw_dieThe DIE of interest.
Returns
The abbrev code. of the DIE.

◆ dwarf_die_abbrev_global_offset()

DW_API int dwarf_die_abbrev_global_offset ( Dwarf_Die  dw_die,
Dwarf_Off dw_abbrev_offset,
Dwarf_Unsigned dw_abbrev_count,
Dwarf_Error dw_error 
)

Return the abbrev section offset of a DIE's abbrevs.

So we can associate a DIE's abbreviations with the contents the abbreviations section. Useful for detailed printing and analysis of abbreviations.

Parameters
dw_dieThe DIE of interest
dw_abbrev_offsetOn success is set to the global offset in the .debug_abbrev section of the abbreviations for the DIE.
dw_abbrev_countOn success is set to the count of abbreviations in the .debug_abbrev section of the abbreviations for the DIE.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_die_CU_offset()

DW_API int dwarf_die_CU_offset ( Dwarf_Die  dw_die,
Dwarf_Off dw_return_offset,
Dwarf_Error dw_error 
)

returns the CU relative offset of the DIE.

See also
dwarf_CU_dieoffset_given_die

This does not identify whether the section is .debug_info or .debug_types, use dwarf_get_die_infotypes_flag() to determine the section.

Parameters
dw_dieThe DIE being queried.
dw_return_offsetReturns the CU relative offset of this DIE.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_die_CU_offset_range()

DW_API int dwarf_die_CU_offset_range ( Dwarf_Die  dw_die,
Dwarf_Off dw_return_CU_header_offset,
Dwarf_Off dw_return_CU_length_bytes,
Dwarf_Error dw_error 
)

Return the offset length of the entire CU of a DIE.

This does not identify whether the section is .debug_info or .debug_types, use dwarf_get_die_infotypes_flag() to determine the section.

Parameters
dw_dieThe DIE being queried.
dw_return_CU_header_offsetOn success returns the section offset of the CU this DIE is in.
dw_return_CU_length_bytesOn success returns the CU length of the CU this DIE is in, including the CU length, header, and all DIEs.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_die_offsets()

DW_API int dwarf_die_offsets ( Dwarf_Die  dw_die,
Dwarf_Off dw_global_offset,
Dwarf_Off dw_local_offset,
Dwarf_Error dw_error 
)

Return section and CU-local offsets of a DIE.

This does not identify whether the section is .debug_info or .debug_types, use dwarf_get_die_infotypes_flag() to determine the section.

Parameters
dw_dieThe DIE of interest.
dw_global_offsetOn success returns the offset of the DIE in its section.
dw_local_offsetOn success returns the offset of the DIE within its CU.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_die_text()

DW_API int dwarf_die_text ( Dwarf_Die  dw_die,
Dwarf_Half  dw_attrnum,
char **  dw_ret_name,
Dwarf_Error dw_error 
)

Given DIE and attribute number return a string.

Returns DW_DLV_NO_ENTRY if the DIE has no attribute dw_attrnum.

Parameters
dw_dieThe DIE of interest.
dw_attrnumAn attribute number, for example DW_AT_name.
dw_ret_nameOn success a pointer to the string is returned. Do not free the string. Many attributes allow various forms that directly or indirectly contain strings and this returns the string.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_diename()

DW_API int dwarf_diename ( Dwarf_Die  dw_die,
char **  dw_diename,
Dwarf_Error dw_error 
)

Return the string from a DW_AT_name attribute.

Returns DW_DLV_NO_ENTRY if the DIE has no attribute DW_AT_name

Parameters
dw_dieThe DIE of interest.
dw_dienameOn success a pointer to the string is returned. Do not free the string. Various forms directly or indirectly contain strings and this follows all of them to their string.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_dieoffset()

DW_API int dwarf_dieoffset ( Dwarf_Die  dw_die,
Dwarf_Off dw_return_offset,
Dwarf_Error dw_error 
)

Return the global section offset of the DIE.

Parameters
dw_dieThe DIE of interest
dw_return_offsetOn success the offset refers to the section of the DIE itself, which may be .debug_offset or .debug_types.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_dietype_offset()

DW_API int dwarf_dietype_offset ( Dwarf_Die  dw_die,
Dwarf_Off dw_return_offset,
Dwarf_Bool dw_is_info,
Dwarf_Error dw_error 
)

Return the offset from the DW_AT_type attribute.

The offset returned is is a global offset from the DW_AT_type of the DIE passed in. If this CU is DWARF4 the offset could be in .debug_types, otherwise it is in .debug_info Check the section of the DIE to know which it is, dwarf_cu_header_basics() will return that.

Added pointer argument to return the section the offset applies to. December 2022.

Parameters
dw_dieThe DIE of interest.
dw_return_offsetIf successful, returns the offset through the pointer.
dw_is_infoIf successful, set to TRUE if the dw_return_offset is in .debug_info and FALSE if the dw_return_offset is in .debug_types.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_get_cu_die_offset_given_cu_header_offset_b()

DW_API int dwarf_get_cu_die_offset_given_cu_header_offset_b ( Dwarf_Debug  dw_dbg,
Dwarf_Off  dw_in_cu_header_offset,
Dwarf_Bool  dw_is_info,
Dwarf_Off dw_out_cu_die_offset,
Dwarf_Error dw_error 
)

Return the CU DIE section offset given CU header offset.

Returns the CU DIE global offset if one knows the CU header global offset.

See also
dwarf_CU_dieoffset_given_die
Parameters
dw_dbgThe Dwarf_Debug of interest.
dw_in_cu_header_offsetThe CU header offset.
dw_is_infoIf TRUE the CU header offset is in .debug_info. Otherwise the CU header offset is in .debug_types.
dw_out_cu_die_offsetThe CU DIE offset returned through this pointer.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_get_die_address_size()

DW_API int dwarf_get_die_address_size ( Dwarf_Die  dw_die,
Dwarf_Half dw_addr_size,
Dwarf_Error dw_error 
)

Get the address size applying to a DIE.

Parameters
dw_dieThe DIE of interest.
dw_addr_sizeOn success, returns the address size that applies to dw_die. Normally 4 or 8.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_get_version_of_die()

DW_API int dwarf_get_version_of_die ( Dwarf_Die  dw_die,
Dwarf_Half dw_version,
Dwarf_Half dw_offset_size 
)

Get the version and offset size.

The values returned apply to the CU this DIE belongs to. This is useful as preparation for calling dwarf_get_form_class

Parameters
dw_dieThe DIE of interest.
dw_versionReturns the version of the CU this DIE is contained in. Standard version numbers are 2 through 5.
dw_offset_sizeReturns the offset_size (4 or 8) of the CU this DIE is contained in.
Returns
On success, returns DW_DLV_OK. If dw_die is null or its contents are corrupted retuns DW_DLV_ERROR and there is nothing useful returned. Never returns DW_DLV_NO_ENTRY.

◆ dwarf_hasattr()

DW_API int dwarf_hasattr ( Dwarf_Die  dw_die,
Dwarf_Half  dw_attrnum,
Dwarf_Bool dw_returned_bool,
Dwarf_Error dw_error 
)

Tells whether a DIE has a particular attribute.

Parameters
dw_dieThe DIE of interest.
dw_attrnumThe attribute number we are asking about, DW_AT_name for example.
dw_returned_boolOn success is set TRUE if dw_die has dw_attrnum and FALSE otherwise.
dw_errorThe usual error detail return pointer.
Returns
Never returns DW_DLV_NO_ENTRY. Returns DW_DLV_OK unless there is an error, in which case it returns DW_DLV_ERROR and sets dw_error to the error details.

◆ dwarf_highpc_b()

DW_API int dwarf_highpc_b ( Dwarf_Die  dw_die,
Dwarf_Addr dw_return_addr,
Dwarf_Half dw_return_form,
enum Dwarf_Form_Class dw_return_class,
Dwarf_Error dw_error 
)

Return the DW_AT_hipc address value.

This is accessing the DW_AT_high_pc attribute. Calculating the high pc involves elements which we don't describe here, but which are shown in the example. See the DWARF5 standard.

See also
Reading high pc from a DIE.
Parameters
dw_dieThe DIE of interest.
dw_return_addrOn success returns the high-pc address for this DIE. If the high-pc is a not DW_FORM_addr and is a non-indexed constant form one must add the value of the DW_AT_low_pc to this to get the true high-pc value as the value returned is an unsigned offset of the associated low-pc value.
dw_return_formOn success returns the actual FORM for this attribute. Needed for certain cases to calculate the true dw_return_addr;
dw_return_classOn success returns the FORM CLASS for this attribute. Needed for certain cases to calculate the true dw_return_addr;
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_language_version_data()

DW_API int dwarf_language_version_data ( Dwarf_Unsigned  dw_lname_name,
int *  dw_default_lower_bound,
const char **  dw_version_string 
)

Return values associated with DW_AT_language_name.

Returns the value of a the default-lower-bound and a string defining the interpretation of the DWARF6 version from the DW_AT_language_version attribute. Replaces dwarf_language_version_string().

Parameters
dw_lname_namePass in a DW_LNAME value, for example DW_LNAME_C (0x0003).
dw_default_lower_bound.On success returns the language code (normally only found on a CU DIE). For example DW_LNAME_C has a default lower bound of zero (0) that will be returned through the pointer.
dw_version_schemeOn success, return the version scheme, For DW_LNAME_C the string returned through the pointer would by "YYYYMM". If there is no version scheme defined, return a NULL through the pointer. Never dealloc or free() the string returned through dw_version_scheme as it is a static constant string.
Returns
Returns DW_DLV_OK or the dw_lang_name is unknown, returns DW_DLV_NO_ENTRY. Never returns DW_DLV_ERROR;

◆ dwarf_language_version_string()

DW_API int dwarf_language_version_string ( Dwarf_Unsigned  dw_lname_name,
int *  dw_default_lower_bound,
const char **  dw_version_string 
)

dwarf_language_version_string is obsolete.

OBSOLETE NAME. Do Not use dwarf_language_version_string() use dwarf_language_version_data().

◆ dwarf_lowpc()

DW_API int dwarf_lowpc ( Dwarf_Die  dw_die,
Dwarf_Addr dw_returned_addr,
Dwarf_Error dw_error 
)

Return the DW_AT_low_pc value.

Parameters
dw_dieThe DIE of interest.
dw_returned_addrOn success returns, through the pointer, the address DW_AT_low_pc defines.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_lvn_name()

DW_API int dwarf_lvn_name ( Dwarf_Die  dw_die,
const char **  dw_ret_version_name,
const char **  dw_ret_version_scheme 
)

Return values associated with DW_AT_language_version.

New in version 2.2.0 July 2025

Given any valid DIE for a Compilation Unit returns the value of a the CU_DIE name of the DWARF6 DW_AT_language_version as a string, as "C++98" for example. And the string defining the format of the language version, for example 'YYYYMM" if DW_LNAME_C. Never free or dealloc the returned string, it is static memory @param dw_die Pass in any valid open Dwarf_Die for the compilation unit of interest. @param dw_reg_version_name On success returns the language version name string through the pointer. Never dealloc or free the string, it points to static memory. @param dw_ret_version_scheme On success, return the version scheme, For DW_LNAME_C the string returned through the pointer would by "YYYYMM". If there is no version scheme defined, return a NULL through the pointer. Never dealloc or free() the string returned through dw_version_scheme as it is a static constant string.

Returns
Returns DW_DLV_OK or the dw_lang_name is unknown, returns DW_DLV_NO_ENTRY. Never returns DW_DLV_ERROR;

◆ dwarf_lvn_name_direct()

DW_API int dwarf_lvn_name_direct ( Dwarf_Unsigned  dw_lv_lang,
Dwarf_Unsigned  dw_lv_ver,
const char **  dw_ret_version_name,
const char **  dw_ret_version_scheme 
)

Return language version name.

New in version 2.2.0 July 2025

Returns the value of a the name of the DWARF6 DW_AT_language_version as a string, as "C++98" for example. And the string defining the format of the language version, for example 'YYYYMM" if DW_LNAME_C. Never free or dealloc the returned string, it is static memory @param dw_lv_lang Pass in a DW_LNAME value, for example DW_LNAME_C (0x0003). @param Pass in the language version, for example 201103 (meeaning C++ 11). @param dw_ret_version_name On success, return the name of the version, "C++11" for example. Never free or dealloc the string. @param dw_reg_version_scheme On success, returns For DW_LNAME_C the string returned through the pointer would be "YYYYMM". If there is no version scheme defined, return a NULL through the pointer. Never dealloc or free() the string returned through dw_version_scheme as it is a static constant string.

Returns
Returns DW_DLV_OK or the dw_lang_name is unknown, returns DW_DLV_NO_ENTRY. Never returns DW_DLV_ERROR;

◆ dwarf_lvn_table_entry()

DW_API int dwarf_lvn_table_entry ( Dwarf_Unsigned  dw_lvn_index,
Dwarf_Unsigned dw_lvn_language_name,
Dwarf_Unsigned dw_lvn_language_version,
const char **  dw_lvn_language_version_scheme,
const char **  dw_lvn_language_version_name 
)

Return values from the DWARF6 language version standard.

New in version 2.2.0 July 2025

Primarily used by dwarfdump. This enables access to the instances of DWARF6 language version table known to this version of libdwarf. None of the strings returned through pointers should be dealloc-d or free-d, they are static strings.

Parameters
dw_lvn_indexTo see all table entries, pass in the index of a table entry, beginning with 0, and call again with subsequent numbers untill the function returns DW_DLV_NO_ENTRY (meaning there are no more entries). The index has no intrinsic meaning.
dw_lvn_language_nameOn success, the function returns the language name through the pointer. For example, a value like DW_LNAME_C.
dw_lvn_language_versionOn success, the function returns the language version through the pointer. For example a number such as for C: 199901.
dw_lvn_language_version_schemeOn success, the function returns a pointer to a string identifying the format of the language version through the pointer. For example "YYYYMM" for C.
dw_lvn_language_version_nameOn success, the function returns a pointer to a string for C. identifying the name of the language version through the pointer. For example: "C99".
Returns

◆ dwarf_offset_list()

DW_API int dwarf_offset_list ( Dwarf_Debug  dw_dbg,
Dwarf_Off  dw_offset,
Dwarf_Bool  dw_is_info,
Dwarf_Off **  dw_offbuf,
Dwarf_Unsigned dw_offcount,
Dwarf_Error dw_error 
)

Return an array of DIE children offsets.

Given a DIE section offset and dw_is_info, returns an array of DIE global [section] offsets of the children of DIE.

Parameters
dw_dbgThe Dwarf_Debug of interest.
dw_offsetA DIE offset.
dw_is_infoIf TRUE says to use the offset in .debug_info. Else use the offset in .debug_types.
dw_offbufA pointer to an array of children DIE global [section] offsets is returned through the pointer.
dw_offcountThe number of elements in dw_offbuf. If the DIE has no children it could be zero, in which case dw_offbuf and dw_offcount are not touched.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc. DW_DLV_NO_ENTRY means there are no children of the DIE, hence no list of child offsets.

On successful return, use dwarf_dealloc(dbg, dw_offbuf, DW_DLA_UARRAY); to dealloc the allocated space.

See also
Using dwarf_offset_list()

◆ dwarf_srclang()

DW_API int dwarf_srclang ( Dwarf_Die  dw_die,
Dwarf_Unsigned dw_returned_lang,
Dwarf_Error dw_error 
)

Return the value of the DW_AT_language attribute.

Returns DWARF5 DW_LANG language name. The DW_LANG value returned lets one access the LANG name as a string with dwarf_get_LANG_name()

To access DW_LNAME names (in DWARF5 or later) see dwarf_srclanglname(). To get the DW_LNAME as a string, call dwarf_get_LNAME_name().

DWARF5 and earlier

The DIE should be a CU DIE.

Parameters
dw_dieThe DIE of interest.
dw_returned_langOn success returns the language code (normally only found on a CU DIE). For example DW_LANG_C (0x0002).
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_srclanglname()

DW_API int dwarf_srclanglname ( Dwarf_Die  dw_die,
Dwarf_Unsigned dw_returned_lname,
Dwarf_Error dw_error 
)

Return the value of the DW_AT_language_name attribute.

New in v2.1.0 July 2025.

Returns a DWARF6 DW_AT language_name name. The DW_LNAME value returned lets one access the LNAME name as a string with dwarf_get_LNAME_name() Also see dwarf_language_version_data() for valued based on DW_LNAME names.

To access DW_LANG names (in DWARF5 or earlier) see dwarf_srclang().

Parameters
dw_dieThe DIE of interest, normally a CU_DIE.
dw_returned_lnameOn success returns the language name (code) (normally only found on a CU DIE). For example DW_LNAME_C (0x0003).
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_srclanglname_version()

DW_API int dwarf_srclanglname_version ( Dwarf_Die  dw_die,
const char *  dw_returned_verstring,
Dwarf_Error dw_error 
)

Return the value of the DW_AT_language_version attribute.

New in v2.1.0 July 2025.

Finds the DW_AT_language_version of the DIE if one is present.

The DIE should be a CU DIE.

Parameters
dw_dieThe DIE of interest.
dw_returnedverstring On success returns the language verion string from a DW_AT_language_version attributes (normally only found on a CU DIE). For example DW_LNAME_C would return a pointer to "YYYYMM" Never free or dealloc the string returned through dw_returned_verstring, it is in static memory.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_tag()

DW_API int dwarf_tag ( Dwarf_Die  dw_die,
Dwarf_Half dw_return_tag,
Dwarf_Error dw_error 
)

Get TAG value of DIE.

Parameters
dw_dieThe DIE of interest
dw_return_tagOn success, set to the DW_TAG value of the DIE.
dw_errorThe usual error detail return pointer.
Returns
Returns DW_DLV_OK etc.

◆ dwarf_validate_die_sibling()

DW_API int dwarf_validate_die_sibling ( Dwarf_Die  dw_sibling,
Dwarf_Off dw_offset 
)

Validate a sibling DIE.

This is used by dwarfdump (when dwarfdump is checking for valid DWARF) to try to catch a corrupt DIE tree.

This does not identify whether the section is .debug_info or .debug_types, use dwarf_get_die_infotypes_flag() to determine the section.

See also
using dwarf_validate_die_sibling
Parameters
dw_siblingPass in a DIE returned by dwarf_siblingof_b().
dw_offsetSet to zero through the pointer.
Returns
Returns DW_DLV_OK if the sibling is at an appropriate place in the section. Otherwise it returns DW_DLV_ERROR indicating the DIE tree is corrupt.