]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarflint: Retrofit cl_lineptr and cl_macptr to DWARF 2
authorPetr Machata <pmachata@redhat.com>
Sat, 9 Oct 2010 14:37:15 +0000 (16:37 +0200)
committerPetr Machata <pmachata@redhat.com>
Sat, 9 Oct 2010 14:37:15 +0000 (16:37 +0200)
- which fixes the failing test case

dwarflint/dwarf_2.cc
dwarflint/dwarf_3.cc
dwarflint/dwarf_version-imp.hh

index c227ebfec3ab43a6d2608a7172bad8a78b7f5083..f3c4aec60f7f16ee10858dd666d1d84e09967b12 100644 (file)
@@ -29,6 +29,8 @@
 
 namespace
 {
+  typedef preset_attribute<cl_reference, cl_constant> 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<sc_value,
                      cl_constant, cl_lineptr, cl_loclistptr,
-                     cl_macptr, cl_rangelistptr> dw2_data_form;
+                     cl_macptr> dw2_data_form;
 
   struct dwarf_2_forms
     : public form_table
index 0aaa0764bde4344ea0c49c701d4f23ee0597a6c5..cf2b753a92c72af8ed2aa68567c8d602348e78b7 100644 (file)
@@ -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));
index 19a63ca1f11c5a169644ab8dd4e164823822b4db..4f00c7c844d78a6768b8174d56a337c2ef915053 100644 (file)
@@ -86,7 +86,6 @@ typedef preset_form<sc_block, cl_block> block_form;
 typedef preset_form<sc_value, cl_constant> const_form;
 typedef preset_form<sc_value, cl_reference> ref_form;
 typedef preset_form<sc_value, cl_flag> flag_form;
-typedef preset_form<sc_block, cl_block> block_form;
 
 typedef preset_attribute<cl_constant> const_attribute;
 typedef preset_attribute<cl_reference> ref_attribute;
@@ -94,7 +93,6 @@ typedef preset_attribute<cl_address> addr_attribute;
 typedef preset_attribute<cl_string> string_attribute;
 typedef preset_attribute<cl_flag> flag_attribute;
 typedef preset_attribute<cl_block> block_attribute;
-typedef preset_attribute<cl_reference, cl_constant> 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