]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Fix handling of constant-or-loclistptr (DW_AT_data_member_location).
authorRoland McGrath <roland@redhat.com>
Wed, 8 Jul 2009 20:45:41 +0000 (13:45 -0700)
committerRoland McGrath <roland@redhat.com>
Wed, 8 Jul 2009 20:59:25 +0000 (13:59 -0700)
libdw/ChangeLog
libdw/c++/dwarf-knowledge.cc
libdw/c++/values.cc

index 81128e3d9252158970c5ed16e821905874ae7aa0..a13136c79bbd76bc0e56ae3cebfcf4caec62ab41 100644 (file)
@@ -1,5 +1,10 @@
 2009-07-08  Roland McGrath  <roland@redhat.com>
 
+       * c++/dwarf-knowledge.cc (expected_value_space):
+       DW_AT_data_member_location can be constant or location.
+       * c++/values.cc (what_space): Treat only data[48] as *ptr when those
+       are expected.  No other data forms can be *ptr.
+
        * c++/output-shape.cc: New file.
        * Makefile.am (libdwpp_a_SOURCES): Add it.
        * c++/dwarf_output: Call add_shape method there.
index 41463ab825c6800c781fb75789360e44c03b88da..c4c7a8114c00441b6d0edbdfddb36708012b6337 100644 (file)
@@ -36,13 +36,15 @@ expected_value_space (int attr, int tag)
     case DW_AT_location:
     case DW_AT_string_length:
     case DW_AT_return_addr:
-    case DW_AT_data_member_location:
     case DW_AT_frame_base:
     case DW_AT_segment:
     case DW_AT_static_link:
     case DW_AT_vtable_elem_location:
       return VS(location);
 
+    case DW_AT_data_member_location:
+      return VS(location) | VS(constant);
+
     case DW_AT_name:
       switch (tag)
        {
index 37e5122c0330841cc9028cb9b06ad9add52e6c5e..bdac9a2813e5a7e3a6eb6427ac93847072348dd1 100644 (file)
@@ -94,20 +94,21 @@ dwarf::attr_value::what_space () const
        return VS_location;
       break;
 
-    case DW_FORM_data1:
-    case DW_FORM_data2:
     case DW_FORM_data4:
     case DW_FORM_data8:
+      // *ptr can only be these forms.  Otherwise these are constants.
+      possible = VS(location) | VS(lineptr) | VS(macptr) | VS(rangelistptr);
+      if (expected & possible)
+       break;
+      /* Fall through.  */
+
+    case DW_FORM_data1:
+    case DW_FORM_data2:
     case DW_FORM_udata:
     case DW_FORM_sdata:
-      /* Target constant, known DWARF constant, or *ptr.  */
+      /* Target constant, known DWARF constant.  */
       possible = (VS(dwarf_constant) | VS(constant)
-                 | VS(source_file) | VS(source_line) | VS(source_column)
-                 | VS(location) // loclistptr
-                 | VS(lineptr) | VS(macptr) | VS(rangelistptr));
-      if ((expected & possible) == (VS(constant) | VS(location)))
-       /* When both are expected, a constant is not a loclistptr.  */
-       return VS_constant;
+                 | VS(source_file) | VS(source_line) | VS(source_column));
       break;
 
     case DW_FORM_string: