DWARF Summary
Table of Contents
DWARF Summary⌗
DWARF5.pdf 太长了懒得看,咱觉得看这个就够了。 实际上咱感兴趣的部分应该是 ch5: Type Entries
Just my note about DWARF5 Debugging Format Standard. Maybe focus on ch5: Type Entries
What is DWARF?⌗
DWARF is the debuginfo standard used on the majority of operating systems today.
2.1 The Debugging Information Entry (DIE) DWARF uses a series of debugging information entries (DIEs) to define a low-level representation of a source program. Each debugging information entry consists of an identifying and a series of attributes. An entry, or group of entries together, provide a description of a corresponding entity in the source program. The tag specifies the class to which an entry belongs and the attributes define the specific characteristics of the entry.
DWARF identifies and attributes⌗
-
tag : DW_TAG_<name>
-
attribute value : DW_AT_<value>
-
general operation : DW_OP_<op>
-
accessibility : DW_ACCESS_(public|private|protected)
-
visibility : DW_VIS_(local|exported|qualified)
-
virtuality : DW_VIRTUALITY_(none|virtual|pure_virtual)
-
segmented addresses : DW_ADDR_<addr>
-
for use in both split or non-split units : DW_RLE_<identifier>
-
language names (C,C99,C_plus_plus,C_plus_plus_11) : DW_LANG_<lang>
-
identifier case code : DW_ID_(case_sensitive|case_insensitive|up_case|down_case**
-
utf8? : DW_AT_use_UTF8
!!! note 同时有很多特殊的 DW_AT_xxx 懒得一一列举了, 我就枚举几个我感兴趣的吧。
-
identifier names : DW_AT_name
-
mangled names : DW_AT_linkage_name
-
template parameters : DW_TAG_template_type_parameter, DW_AT_type, DW_AT_name, DW_AT_default_value
Type Entries⌗
Base Type⌗
- DW_TAG_base_type
- name : string : DW_AT_name?
- encoding : see DWARF5.pdf : DW_AT_encoding
- endianity : { DW_END_default, DW_END_big, DW_END_little } : DW_AT_endianity? (default = the default for the target architecture)
- value size : DW_AT_byte_size
- DW_AT_bit_size, DA_AT_data_bit_offset (default = 0) : if value of the type does not fully occupy the value size
For example,
int
in C : DW_AT_name =int
, DW_AT_encoding = DW_ATE_signed, DW_AT_byte_size = 4.
Unspecified Type⌗
- DW_TAG_unspecified_type (
void
in C,auto
in C++) - DW_AT_name?
Type Modifier⌗
- DW_TAG_(atomic|const|immutable|packed|pointer|reference|restrict|rvalue_reference|shared|volatile)_type
- DW_AT_name?
- DW_AT_type : reference to a base type
- DW_AT_address_class? : if pointer or reference type, describe how objects having the given pointer.
- DW_AT_count? : if DW_TAG_shared_type (default = “infinite”), blocksize specified for the type.
Typedef⌗
- DW_TAG_typedef
- DW_AT_name
- DW_AT_type : reference to the type named by the typedef.
Array Type⌗
- DW_TAG_array_type
- DW_AT_name
- DW_AT_ordering? : DW_ORD_(col|row)_major (default = the default ordering for the source language)
- DW_AT_type : the type of each element
- (DW_AT_byte_stride | DW_AT_bit_stride)?
- (DW_AT_byte_size | DW_AT_bit_size)? : the amount of storage needed to hold an instance of the array type.
懒得写,总之比较复杂,建议看 ch5.5: Array Type Entries
Coarray Type⌗
- DW_TAG_coarray_type
- DW_AT_name
- [DW_TAG_subrange_type] : one for each codimension
- DW_AT_type : the type of each element
In Fortran, a “coarray” is an array whose elements are located in different processes rather than in the memory of one process. The individual elements of a coarray can be scalars or arrays. Similar to arrays, coarrays have “codimensions” that are indexed using a “coindex” or multiple “coindices”.
Structure, Union, Class and Interface Type Entries⌗
Structure, Union, Class and Interface Type Entries⌗
- DW_TAG_structure_type | DW_TAG_union_type | DW_TAG_class_type
- DW_AT_name?
- (DW_AT_byte_size | DW_AT_bit_size)?
- DW_AT_declaration? : incomplete type
- DW_AT_signature? : incomplete declaration
- DW_AT_specification? : reference to the incomplete type
- DW_AT_calling_convention? : indicate whether is passed by reference or value.
- DW_CC_normal
- DW_CC_pass_by_value
- DW_CC_pass_by_reference
Interface Type⌗
- DW_TAG_interface_type
- DW_AT_name
Derived or Extended Structures, Classes and Interfaces.⌗
- DW_TAG_inheritance
- DW_AT_type
- DW_AT_data_member_location
- DW_AT_accessibility?
- DW_AT_virtuality?
Access Declarations⌗
- DW_TAG_access_declaration
- DW_AT_name
- DW_AT_accessibility
Friends⌗
- DW_TAG_friend
- DW_AT_friend : reference to the declaration of the friend
Data Member Entries⌗
- DW_TAG_member
- DW_AT_name
- DW_AT_type
- DW_AT_accessibility
- DW_AT_mutable
- (DW_AT_data_member_location | DW_AT_data_bit_offset)
Class Variable Entries⌗
- DW_TAG_variable
- DW_AT_accessibility
Member Function Entries⌗
- DW_TAG_subprogram
- DW_AT_accessibility
- DW_AT_virtuality?
- DW_AT_explicit?
- DW_AT_vtable_ele_location?
- DW_AT_object_pointer?
- DW_AT_reference?
- DW_AT_rvalue_reference?
- DW_AT_specification?
- DW_AT_deleted
Class Template Instantiations⌗
TODO
Variant Entries⌗
- DW_TAG_variant_part
- DW_AT_discr?
- DW_AT_type?
- DW_TAG_variant
- DW_AT_discr_value
- DW_AT_discr_list
Condition Entries⌗
- DW_TAG_condition
- DW_AT_name
- DW_TAG_variable
- DW_TAG_member | DW_TAG_formal_parameter
- DW_TAG_constant | DW_TAG_subrange_type
- DW_AT_type
Enum Entries⌗
- DW_TAG_enumeration_type
Subroutine Type Entries⌗
- DW_TAG_subroutine_type
String Type Entries⌗
- DW_TAG_string_type
Set Type Entries⌗
- DW_TAG_set_type
Subrange Type Entries⌗
- DW_TAG_subrange_type
Pointer to Member Type Entries⌗
- DW_TAG_ptr_to_member_type
File Type Entries⌗
- DW_TAG_file_type
Dynamic Type Entries⌗
- DW_TAG_dynamic_type
Template Alias Entries⌗
- DW_TAG_template_alias
Dynamic Properties of Types⌗
- DW_TAG_dynamic_type
- DW_AT_(data_location|allocated|associated)