From: Seva Alekseyev Date: Sat, 10 Oct 2020 12:38:13 +0000 (-0400) Subject: DWARFv1 constants in enums, DW_FORM_ref parsing (#335) X-Git-Tag: v0.27~7 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9704150f1f5cf8219f85d4bd5b23deac445d448f;p=pyelftools.git DWARFv1 constants in enums, DW_FORM_ref parsing (#335) --- diff --git a/elftools/dwarf/enums.py b/elftools/dwarf/enums.py index 9ff90d7..c900867 100644 --- a/elftools/dwarf/enums.py +++ b/elftools/dwarf/enums.py @@ -17,15 +17,19 @@ ENUM_DW_TAG = dict( DW_TAG_entry_point = 0x03, DW_TAG_enumeration_type = 0x04, DW_TAG_formal_parameter = 0x05, + DW_TAG_global_subroutine = 0x06, + DW_TAG_global_variable = 0x07, DW_TAG_imported_declaration = 0x08, DW_TAG_label = 0x0a, DW_TAG_lexical_block = 0x0b, + DW_TAG_local_variable = 0x0c, DW_TAG_member = 0x0d, DW_TAG_pointer_type = 0x0f, DW_TAG_reference_type = 0x10, DW_TAG_compile_unit = 0x11, DW_TAG_string_type = 0x12, DW_TAG_structure_type = 0x13, + DW_TAG_subroutine = 0x14, DW_TAG_subroutine_type = 0x15, DW_TAG_typedef = 0x16, DW_TAG_union_type = 0x17, @@ -111,6 +115,10 @@ ENUM_DW_AT = dict( DW_AT_sibling = 0x01, DW_AT_location = 0x02, DW_AT_name = 0x03, + DW_AT_fund_type = 0x05, + DW_AT_mod_fund_type = 0x06, + DW_AT_user_def_type = 0x07, + DW_AT_mod_u_d_type = 0x08, DW_AT_ordering = 0x09, DW_AT_subscr_data = 0x0a, DW_AT_byte_size = 0x0b, @@ -136,7 +144,9 @@ ENUM_DW_AT = dict( DW_AT_is_optional = 0x21, DW_AT_lower_bound = 0x22, DW_AT_producer = 0x25, + DW_AT_protected = 0x26, DW_AT_prototyped = 0x27, + DW_AT_public = 0x28, DW_AT_return_addr = 0x2a, DW_AT_start_scope = 0x2c, DW_AT_bit_stride = 0x2e, @@ -304,6 +314,7 @@ ENUM_DW_AT = dict( ENUM_DW_FORM = dict( DW_FORM_null = 0x00, DW_FORM_addr = 0x01, + DW_FORM_ref = 0x02, DW_FORM_block2 = 0x03, DW_FORM_block4 = 0x04, DW_FORM_data2 = 0x05, diff --git a/elftools/dwarf/locationlists.py b/elftools/dwarf/locationlists.py index a503e43..e6c735f 100644 --- a/elftools/dwarf/locationlists.py +++ b/elftools/dwarf/locationlists.py @@ -106,7 +106,7 @@ class LocationParser(object): @staticmethod def _attribute_has_loc_expr(attr, dwarf_version): - return ((dwarf_version < 4 and attr.form == 'DW_FORM_block1' and + return ((dwarf_version < 4 and attr.form.startswith('DW_FORM_block') and not attr.name == 'DW_AT_const_value') or attr.form == 'DW_FORM_exprloc') diff --git a/elftools/dwarf/structs.py b/elftools/dwarf/structs.py index 04f6c75..9513053 100644 --- a/elftools/dwarf/structs.py +++ b/elftools/dwarf/structs.py @@ -195,6 +195,7 @@ class DWARFStructs(object): DW_FORM_strp=self.Dwarf_offset(''), DW_FORM_flag=self.Dwarf_uint8(''), + DW_FORM_ref=self.Dwarf_uint32(''), DW_FORM_ref1=self.Dwarf_uint8(''), DW_FORM_ref2=self.Dwarf_uint16(''), DW_FORM_ref4=self.Dwarf_uint32(''),