From: Petr Machata Date: Sat, 9 Oct 2010 14:37:15 +0000 (+0200) Subject: dwarflint: Retrofit cl_lineptr and cl_macptr to DWARF 2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c06ba8f77bb0ef38bcc548de6fe7323c9b53f3be;p=thirdparty%2Felfutils.git dwarflint: Retrofit cl_lineptr and cl_macptr to DWARF 2 - which fixes the failing test case --- diff --git a/dwarflint/dwarf_2.cc b/dwarflint/dwarf_2.cc index c227ebfec..f3c4aec60 100644 --- a/dwarflint/dwarf_2.cc +++ b/dwarflint/dwarf_2.cc @@ -29,6 +29,8 @@ namespace { + typedef preset_attribute const_or_ref_attribute; + struct dwarf_2_attributes : public attribute_table { @@ -43,6 +45,9 @@ namespace // appropriate attributes with cl_exprloc form DWARF 4 and // cl_loclistptr (even though in DWARF 4 it's actually only // DW_FORM_exprloc that has this class). + // + // Similarly with cl_lineptr and cl_macptr. cl_rangelistptr + // wasn't introduced until DWARF 3. add (ref_attribute (DW_AT_sibling)); add (location_attribute (DW_AT_location)); @@ -51,7 +56,7 @@ namespace add (const_attribute (DW_AT_byte_size)); add (const_attribute (DW_AT_bit_offset)); add (const_attribute (DW_AT_bit_size)); - add (const_attribute (DW_AT_stmt_list)); + add (attribute (DW_AT_stmt_list, cl_lineptr)); add (addr_attribute (DW_AT_low_pc)); add (addr_attribute (DW_AT_high_pc)); add (const_attribute (DW_AT_language)); @@ -93,7 +98,7 @@ namespace add (location_attribute (DW_AT_frame_base)); add (ref_attribute (DW_AT_friend)); add (const_attribute (DW_AT_identifier_case)); - add (const_attribute (DW_AT_macro_info)); + add (attribute (DW_AT_macro_info, cl_macptr)); add (block_attribute (DW_AT_namelist_item)); add (ref_attribute (DW_AT_priority)); add (location_attribute (DW_AT_segment)); @@ -115,11 +120,9 @@ namespace {} }; - // xxx We still need to retrofit all the cl_*ptr to above list of - // attributes. Except cl_loclistptr which is already done. typedef preset_form dw2_data_form; + cl_macptr> dw2_data_form; struct dwarf_2_forms : public form_table diff --git a/dwarflint/dwarf_3.cc b/dwarflint/dwarf_3.cc index 0aaa0764b..cf2b753a9 100644 --- a/dwarflint/dwarf_3.cc +++ b/dwarflint/dwarf_3.cc @@ -40,7 +40,6 @@ namespace add (dynval_attribute (DW_AT_byte_size)); add (dynval_attribute (DW_AT_bit_offset)); add (dynval_attribute (DW_AT_bit_size)); - add (attribute (DW_AT_stmt_list, cl_lineptr)); add (location_attribute (DW_AT_string_length)); add (dynval_attribute (DW_AT_lower_bound)); add (location_attribute (DW_AT_return_addr)); @@ -54,7 +53,6 @@ namespace add (attribute (DW_AT_data_member_location, dw_class_set (cl_exprloc, cl_constant, cl_loclistptr))); add (location_attribute (DW_AT_frame_base)); - add (attribute (DW_AT_macro_info, cl_macptr)); add (location_attribute (DW_AT_segment)); add (location_attribute (DW_AT_static_link)); add (location_attribute (DW_AT_use_location)); @@ -105,7 +103,9 @@ namespace // In DWARF 2 we made all the const forms into various cl_*ptr, // since that's how the standard was worded: it allowed - // DW_AT_location to have any constant form. Revert that. + // DW_AT_location to have any constant form. In DWARF 3, only + // data4 and data8 are like this. In addition, these two can + // also be cl_rangelistptr. add (const_form (DW_FORM_data1, fw_1)); add (const_form (DW_FORM_data2, fw_2)); add (dw3_data_form (DW_FORM_data4, fw_4)); diff --git a/dwarflint/dwarf_version-imp.hh b/dwarflint/dwarf_version-imp.hh index 19a63ca1f..4f00c7c84 100644 --- a/dwarflint/dwarf_version-imp.hh +++ b/dwarflint/dwarf_version-imp.hh @@ -86,7 +86,6 @@ typedef preset_form block_form; typedef preset_form const_form; typedef preset_form ref_form; typedef preset_form flag_form; -typedef preset_form block_form; typedef preset_attribute const_attribute; typedef preset_attribute ref_attribute; @@ -94,7 +93,6 @@ typedef preset_attribute addr_attribute; typedef preset_attribute string_attribute; typedef preset_attribute flag_attribute; typedef preset_attribute block_attribute; -typedef preset_attribute const_or_ref_attribute; // [DWARF 3, DWARF 4, section 2.19]: attributes that [...] specify a // property [...] that is an integer value, where the value may be