libdwarf
|
Functions | |
int | dwarf_attrlist (Dwarf_Die dw_die, Dwarf_Attribute **dw_attrbuf, Dwarf_Signed *dw_attrcount, Dwarf_Error *dw_error) |
Gets the full list of attributes. More... | |
int | dwarf_hasform (Dwarf_Attribute dw_attr, Dwarf_Half dw_form, Dwarf_Bool *dw_returned_bool, Dwarf_Error *dw_error) |
Sets TRUE if a Dwarf_Attribute has the indicated FORM. More... | |
int | dwarf_whatform (Dwarf_Attribute dw_attr, Dwarf_Half *dw_returned_final_form, Dwarf_Error *dw_error) |
Return the form of the Dwarf_Attribute. More... | |
int | dwarf_whatform_direct (Dwarf_Attribute dw_attr, Dwarf_Half *dw_returned_initial_form, Dwarf_Error *dw_error) |
Return the initial form of the Dwarf_Attribute. More... | |
int | dwarf_whatattr (Dwarf_Attribute dw_attr, Dwarf_Half *dw_returned_attrnum, Dwarf_Error *dw_error) |
Return the attribute number of the Dwarf_Attribute. More... | |
int | dwarf_formref (Dwarf_Attribute dw_attr, Dwarf_Off *dw_return_offset, Dwarf_Bool *dw_is_info, Dwarf_Error *dw_error) |
Retrieve the CU-relative offset of a reference. More... | |
int | dwarf_global_formref_b (Dwarf_Attribute dw_attr, Dwarf_Off *dw_return_offset, Dwarf_Bool *dw_offset_is_info, Dwarf_Error *dw_error) |
Return the section-relative offset of a Dwarf_Attribute. More... | |
int | dwarf_global_formref (Dwarf_Attribute dw_attr, Dwarf_Off *dw_return_offset, Dwarf_Error *dw_error) |
Same as dwarf_global_formref_b except... More... | |
int | dwarf_formsig8 (Dwarf_Attribute dw_attr, Dwarf_Sig8 *dw_returned_sig_bytes, Dwarf_Error *dw_error) |
Return an 8 byte reference form for DW_FORM_ref_sig8. More... | |
int | dwarf_formsig8_const (Dwarf_Attribute dw_attr, Dwarf_Sig8 *dw_returned_sig_bytes, Dwarf_Error *dw_error) |
Return an 8 byte reference form for DW_FORM_data8. More... | |
int | dwarf_formaddr (Dwarf_Attribute dw_attr, Dwarf_Addr *dw_returned_addr, Dwarf_Error *dw_error) |
Return the address when the attribute has form address. More... | |
int | dwarf_get_debug_addr_index (Dwarf_Attribute dw_attr, Dwarf_Unsigned *dw_return_index, Dwarf_Error *dw_error) |
Get the addr index of a Dwarf_Attribute. More... | |
int | dwarf_formflag (Dwarf_Attribute dw_attr, Dwarf_Bool *dw_returned_bool, Dwarf_Error *dw_error) |
Return the flag value of a flag form. More... | |
int | dwarf_formudata (Dwarf_Attribute dw_attr, Dwarf_Unsigned *dw_returned_val, Dwarf_Error *dw_error) |
Return an unsigned value. More... | |
int | dwarf_formsdata (Dwarf_Attribute dw_attr, Dwarf_Signed *dw_returned_val, Dwarf_Error *dw_error) |
Return a signed value. More... | |
int | dwarf_formdata16 (Dwarf_Attribute dw_attr, Dwarf_Form_Data16 *dw_returned_val, Dwarf_Error *dw_error) |
Return a 16 byte Dwarf_Form_Data16 value. More... | |
int | dwarf_formblock (Dwarf_Attribute dw_attr, Dwarf_Block **dw_returned_block, Dwarf_Error *dw_error) |
Return an allocated filled-in Form_Block. More... | |
int | dwarf_formstring (Dwarf_Attribute dw_attr, char **dw_returned_string, Dwarf_Error *dw_error) |
Return a pointer to a string. More... | |
int | dwarf_get_debug_str_index (Dwarf_Attribute dw_attr, Dwarf_Unsigned *dw_return_index, Dwarf_Error *dw_error) |
Return a string index. More... | |
int | dwarf_formexprloc (Dwarf_Attribute dw_attr, Dwarf_Unsigned *dw_return_exprlen, Dwarf_Ptr *dw_block_ptr, Dwarf_Error *dw_error) |
Return a pointer-to and length-of a block of data. More... | |
enum Dwarf_Form_Class | dwarf_get_form_class (Dwarf_Half dw_version, Dwarf_Half dw_attrnum, Dwarf_Half dw_offset_size, Dwarf_Half dw_form) |
Return the FORM_CLASS applicable. Four pieces of information are necessary to get the correct FORM_CLASS. More... | |
int | dwarf_attr_offset (Dwarf_Die dw_die, Dwarf_Attribute dw_attr, Dwarf_Off *dw_return_offset, Dwarf_Error *dw_error) |
Return the offset of an attribute in its section. More... | |
int | dwarf_uncompress_integer_block_a (Dwarf_Debug dw_dbg, Dwarf_Unsigned dw_input_length_in_bytes, void *dw_input_block, Dwarf_Unsigned *dw_value_count, Dwarf_Signed **dw_value_array, Dwarf_Error *dw_error) |
Uncompress a block of sleb numbers It's not much of a compression so not much of an uncompression. Developed by Sun Microsystems and it is unclear if it was ever used. More... | |
void | dwarf_dealloc_uncompressed_block (Dwarf_Debug dw_dbg, void *dw_value_array) |
Dealloc what dwarf_uncompress_integer_block_a allocated. More... | |
int | dwarf_convert_to_global_offset (Dwarf_Attribute dw_attr, Dwarf_Off dw_offset, Dwarf_Off *dw_return_offset, Dwarf_Error *dw_error) |
Convert local offset to global offset. More... | |
void | dwarf_dealloc_attribute (Dwarf_Attribute dw_attr) |
Dealloc a Dwarf_Attribute When this call returns the dw_attr is a stale pointer. More... | |
int | dwarf_discr_list (Dwarf_Debug dw_dbg, Dwarf_Small *dw_blockpointer, Dwarf_Unsigned dw_blocklen, Dwarf_Dsc_Head *dw_dsc_head_out, Dwarf_Unsigned *dw_dsc_array_length_out, Dwarf_Error *dw_error) |
Return an array of discriminant values. More... | |
int | dwarf_discr_entry_u (Dwarf_Dsc_Head dw_dsc, Dwarf_Unsigned dw_entrynum, Dwarf_Half *dw_out_type, Dwarf_Unsigned *dw_out_discr_low, Dwarf_Unsigned *dw_out_discr_high, Dwarf_Error *dw_error) |
Access a single unsigned discriminant list entry. More... | |
int | dwarf_discr_entry_s (Dwarf_Dsc_Head dw_dsc, Dwarf_Unsigned dw_entrynum, Dwarf_Half *dw_out_type, Dwarf_Signed *dw_out_discr_low, Dwarf_Signed *dw_out_discr_high, Dwarf_Error *dw_error) |
Access to a single signed discriminant list entry. More... | |
Access to the details of DIEs
int dwarf_attrlist | ( | Dwarf_Die | dw_die, |
Dwarf_Attribute ** | dw_attrbuf, | ||
Dwarf_Signed * | dw_attrcount, | ||
Dwarf_Error * | dw_error | ||
) |
dw_die | The DIE from which to pull attributes. |
dw_attrbuf | The pointer is set to point to an array of Dwarf_Attribute (pointers to attribute data). This array must eventually be deallocated. |
dw_attrcount | The number of entries in the array of pointers. There is no null-pointer to terminate the list, use this count. |
dw_error | A place to return error details. |
int dwarf_hasform | ( | Dwarf_Attribute | dw_attr, |
Dwarf_Half | dw_form, | ||
Dwarf_Bool * | dw_returned_bool, | ||
Dwarf_Error * | dw_error | ||
) |
dw_attr | The Dwarf_Attribute of interest. |
dw_form | The DW_FORM you are asking about, DW_FORM_strp for example. |
dw_returned_bool | The pointer passed in must be a valid non-null pointer to a Dwarf_Bool. On success, sets the value to TRUE or FALSE. |
dw_error | A place to return error details. |
int dwarf_whatform | ( | Dwarf_Attribute | dw_attr, |
Dwarf_Half * | dw_returned_final_form, | ||
Dwarf_Error * | dw_error | ||
) |
dw_attr | The Dwarf_Attribute of interest. |
dw_returned_final_form | The form of the item is returned through the pointer. If the base form is DW_FORM_indirect the function resolves the final form and returns that final form. |
dw_error | A place to return error details. |
int dwarf_whatform_direct | ( | Dwarf_Attribute | dw_attr, |
Dwarf_Half * | dw_returned_initial_form, | ||
Dwarf_Error * | dw_error | ||
) |
dw_attr | The Dwarf_Attribute of interest. |
dw_returned_initial_form | The form of the item is returned through the pointer. If the base form is DW_FORM_indirect the value set is DW_FORM_indirect. |
dw_error | A place to return error details. |
int dwarf_whatattr | ( | Dwarf_Attribute | dw_attr, |
Dwarf_Half * | dw_returned_attrnum, | ||
Dwarf_Error * | dw_error | ||
) |
dw_attr | The Dwarf_Attribute of interest. |
dw_returned_attrnum | The attribute number of the attribute is returned through the pointer. For example, DW_AT_name |
dw_error | A place to return error details. |
int dwarf_formref | ( | Dwarf_Attribute | dw_attr, |
Dwarf_Off * | dw_return_offset, | ||
Dwarf_Bool * | dw_is_info, | ||
Dwarf_Error * | dw_error | ||
) |
The DW_FORM of the attribute must be one of a small set of local reference forms: DW_FORM_ref<n> or DW_FORM_udata.
dw_attr | The Dwarf_Attribute of interest. |
dw_return_offset | Returns the CU-relative offset through the pointer. |
dw_is_info | Returns a flag through the pointer. TRUE if the offset is in .debug_info, FALSE if it is in .debug_types |
dw_error | A place to return error details. |
int dwarf_global_formref_b | ( | Dwarf_Attribute | dw_attr, |
Dwarf_Off * | dw_return_offset, | ||
Dwarf_Bool * | dw_offset_is_info, | ||
Dwarf_Error * | dw_error | ||
) |
The target section of the returned offset can be in various sections depending on the FORM. Only a DW_FORM_ref_sig8 can change the returned offset of a .debug_info DIE via a lookup into .debug_types by changing dw_offset_is_info to FALSE (DWARF4).
The caller must determine the target section from the FORM.
dw_attr | The Dwarf_Attribute of interest. |
dw_return_offset | Returns the CU-relative offset through the pointer. |
dw_offset_is_info | For references to DIEs this informs whether the target DIE (the target the offset refers to) is in .debug_info or .debug_types. For non-DIE targets this field is not meaningful. Refer to the attribute FORM to determine the target section of the offset. |
dw_error | A place to return error details. |
int dwarf_global_formref | ( | Dwarf_Attribute | dw_attr, |
Dwarf_Off * | dw_return_offset, | ||
Dwarf_Error * | dw_error | ||
) |
This is the same, except there is no dw_offset_is_info pointer so in the case of DWARF4 and DW_FORM_ref_sig8 it is not possible to determine which section the offset applies to!
int dwarf_formsig8 | ( | Dwarf_Attribute | dw_attr, |
Dwarf_Sig8 * | dw_returned_sig_bytes, | ||
Dwarf_Error * | dw_error | ||
) |
dw_attr | The Dwarf_Attribute of interest. |
dw_returned_sig_bytes | On success returns DW_DLV_OK and copies the 8 bytes into dw_returned_sig_bytes. |
dw_error | A place to return error details. |
int dwarf_formsig8_const | ( | Dwarf_Attribute | dw_attr, |
Dwarf_Sig8 * | dw_returned_sig_bytes, | ||
Dwarf_Error * | dw_error | ||
) |
dw_attr | The Dwarf_Attribute of interest. |
dw_returned_sig_bytes | On success Returns DW_DLV_OK and copies the 8 bytes into dw_returned_sig_bytes. |
dw_error | A place to return error details. |
int dwarf_formaddr | ( | Dwarf_Attribute | dw_attr, |
Dwarf_Addr * | dw_returned_addr, | ||
Dwarf_Error * | dw_error | ||
) |
There are several address forms, some of them indexed.
dw_attr | The Dwarf_Attribute of interest. |
dw_returned_addr | On success this set through the pointer to the address in the attribute. |
dw_error | A place to return error details. |
int dwarf_get_debug_addr_index | ( | Dwarf_Attribute | dw_attr, |
Dwarf_Unsigned * | dw_return_index, | ||
Dwarf_Error * | dw_error | ||
) |
So a consumer can get the index when the object with the actual .debug_addr section is elsewhere (Debug Fission). Or if the caller just wants the index. Only call it when you know it should does have an index address FORM such as DW_FORM_addrx1 or one of the GNU address index forms.
dw_attr | The Dwarf_Attribute of interest. |
dw_return_index | If successful it returns the index through the pointer. |
dw_error | The usual error pointer. |
int dwarf_formflag | ( | Dwarf_Attribute | dw_attr, |
Dwarf_Bool * | dw_returned_bool, | ||
Dwarf_Error * | dw_error | ||
) |
It is an error if the FORM is not a flag form.
dw_attr | The Dwarf_Attribute of interest. |
dw_returned_bool | Returns either TRUE or FALSE through the pointer. |
dw_error | The usual error pointer. |
int dwarf_formudata | ( | Dwarf_Attribute | dw_attr, |
Dwarf_Unsigned * | dw_returned_val, | ||
Dwarf_Error * | dw_error | ||
) |
The form can be an unsigned or signed integral type but if it is a signed type the value must be non-negative. It is an error otherwise.
dw_attr | The Dwarf_Attribute of interest. |
dw_returned_val | On success returns the unsigned value through the pointer. |
dw_error | The usual error pointer. |
int dwarf_formsdata | ( | Dwarf_Attribute | dw_attr, |
Dwarf_Signed * | dw_returned_val, | ||
Dwarf_Error * | dw_error | ||
) |
The form must be a signed integral type. It is an error otherwise.
dw_attr | The Dwarf_Attribute of interest. |
dw_returned_val | On success returns the signed value through the pointer. |
dw_error | The usual error pointer. |
int dwarf_formdata16 | ( | Dwarf_Attribute | dw_attr, |
Dwarf_Form_Data16 * | dw_returned_val, | ||
Dwarf_Error * | dw_error | ||
) |
We just store the bytes in a struct, we have no 16 byte integer type. It is an error if the FORM is not DW_FORM_data16
dw_attr | The Dwarf_Attribute of interest. |
dw_returned_val | Copies the 16 byte value into the pointed to area. |
dw_error | The usual error pointer. |
int dwarf_formblock | ( | Dwarf_Attribute | dw_attr, |
Dwarf_Block ** | dw_returned_block, | ||
Dwarf_Error * | dw_error | ||
) |
It is an error if the DW_FORM in the attribute is not a block form. DW_FORM_block2 is an example of a block form.
dw_attr | The Dwarf_Attribute of interest. |
dw_returned_block | Allocates a Dwarf_Block and returns a pointer to the filled-in block. |
dw_error | The usual error pointer. |
int dwarf_formstring | ( | Dwarf_Attribute | dw_attr, |
char ** | dw_returned_string, | ||
Dwarf_Error * | dw_error | ||
) |
dw_attr | The Dwarf_Attribute of interest. |
dw_returned_string | Puts a pointer to a string in the DWARF information if the FORM of the attribute is some sort of string FORM. |
dw_error | The usual error pointer. |
int dwarf_get_debug_str_index | ( | Dwarf_Attribute | dw_attr, |
Dwarf_Unsigned * | dw_return_index, | ||
Dwarf_Error * | dw_error | ||
) |
dw_attr | The Dwarf_Attribute of interest. |
dw_return_index | If the form is a string index form (for example DW_FORM_strx) the string index value is returned via the pointer. |
dw_error | The usual error pointer. |
int dwarf_formexprloc | ( | Dwarf_Attribute | dw_attr, |
Dwarf_Unsigned * | dw_return_exprlen, | ||
Dwarf_Ptr * | dw_block_ptr, | ||
Dwarf_Error * | dw_error | ||
) |
dw_attr | The Dwarf_Attribute of interest. |
dw_return_exprlen | Returns the length in bytes of the block if it succeeds. |
dw_block_ptr | Returns a pointer to the first byte of the block of data if it succeeds. |
dw_error | The usual error pointer. |
enum Dwarf_Form_Class dwarf_get_form_class | ( | Dwarf_Half | dw_version, |
Dwarf_Half | dw_attrnum, | ||
Dwarf_Half | dw_offset_size, | ||
Dwarf_Half | dw_form | ||
) |
dw_version | The CU's DWARF version. Standard numbers are 2,3,4, or 5. |
dw_attrnum | For example DW_AT_name |
dw_offset_size | The offset size applicable to the compilation unit relevant to the attribute and form. |
dw_form | The FORM number, for example DW_FORM_data4 |
int dwarf_attr_offset | ( | Dwarf_Die | dw_die, |
Dwarf_Attribute | dw_attr, | ||
Dwarf_Off * | dw_return_offset, | ||
Dwarf_Error * | dw_error | ||
) |
dw_die | The DIE of interest. |
dw_attr | A Dwarf_Attribute of interest in this DIE |
dw_return_offset | The offset is in .debug_info if the DIE is there. The offset is in .debug_types if the DIE is there. |
dw_error | The usual error pointer. |
int dwarf_uncompress_integer_block_a | ( | Dwarf_Debug | dw_dbg, |
Dwarf_Unsigned | dw_input_length_in_bytes, | ||
void * | dw_input_block, | ||
Dwarf_Unsigned * | dw_value_count, | ||
Dwarf_Signed ** | dw_value_array, | ||
Dwarf_Error * | dw_error | ||
) |
void dwarf_dealloc_uncompressed_block | ( | Dwarf_Debug | dw_dbg, |
void * | dw_value_array | ||
) |
dw_dbg | The Dwarf_Debug of interest |
dw_value_array | The array was called an array of Dwarf_Signed. We dealloc all of it without needing dw_value_count. |
int dwarf_convert_to_global_offset | ( | Dwarf_Attribute | dw_attr, |
Dwarf_Off | dw_offset, | ||
Dwarf_Off * | dw_return_offset, | ||
Dwarf_Error * | dw_error | ||
) |
Uses the DW_FORM of the attribute to determine if the dw_offset is local, and if so, adds the CU base offset to adjust dw_offset.
dw_attr | The attribute the local offset was extracted from. |
dw_offset | The global offset of the attribute. |
dw_return_offset | The returned section (global) offset. |
dw_error | The usual error pointer. |
void dwarf_dealloc_attribute | ( | Dwarf_Attribute | dw_attr | ) |
dw_attr | The attribute to dealloc. |
int dwarf_discr_list | ( | Dwarf_Debug | dw_dbg, |
Dwarf_Small * | dw_blockpointer, | ||
Dwarf_Unsigned | dw_blocklen, | ||
Dwarf_Dsc_Head * | dw_dsc_head_out, | ||
Dwarf_Unsigned * | dw_dsc_array_length_out, | ||
Dwarf_Error * | dw_error | ||
) |
This applies if a DW_TAG_variant has one of the DW_FORM_block forms.
For an example of use and dealloc:
dw_dbg | The applicable Dwarf_Debug |
dw_blockpointer | The bl_data value from a Dwarf_Block. |
dw_blocklen | The bl_len value from a Dwarf_Block. |
dw_dsc_head_out | On success returns a pointer to an array of discriminant values in an opaque struct. |
dw_dsc_array_length_out | On success returns the number of entries in the dw_dsc_head_out array. |
dw_error | The usual error pointer. |
int dwarf_discr_entry_u | ( | Dwarf_Dsc_Head | dw_dsc, |
Dwarf_Unsigned | dw_entrynum, | ||
Dwarf_Half * | dw_out_type, | ||
Dwarf_Unsigned * | dw_out_discr_low, | ||
Dwarf_Unsigned * | dw_out_discr_high, | ||
Dwarf_Error * | dw_error | ||
) |
It is up to the caller to know whether the discriminant values are signed or unsigned (therefore to know whether this or dwarf_discr_entry_s. should be called)
dw_dsc | The Dwarf_Dsc_Head applicable. |
dw_entrynum | Valid values are zero to dw_dsc_array_length_out-1 |
dw_out_type | On success is set to either DW_DSC_label or DW_DSC_range through the pointer. |
dw_out_discr_low | On success set to the lowest in this discriminant range |
dw_out_discr_high | On success set to the highest in this discriminant range |
dw_error | The usual error pointer. |
int dwarf_discr_entry_s | ( | Dwarf_Dsc_Head | dw_dsc, |
Dwarf_Unsigned | dw_entrynum, | ||
Dwarf_Half * | dw_out_type, | ||
Dwarf_Signed * | dw_out_discr_low, | ||
Dwarf_Signed * | dw_out_discr_high, | ||
Dwarf_Error * | dw_error | ||
) |
The same as dwarf_discr_entry_u except here the values are signed.