]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Fix dwarf_getlocation braino in constant-form case handling.
authorRoland McGrath <roland@redhat.com>
Sun, 22 Nov 2009 01:03:34 +0000 (17:03 -0800)
committerRoland McGrath <roland@redhat.com>
Sun, 22 Nov 2009 01:03:53 +0000 (17:03 -0800)
libdw/ChangeLog
libdw/dwarf_getlocation.c

index 33a18baf59a9dd16a1bfb29dae7f453f5b9ead77..9506daeadafd24ce8c4a91915d1bcd332e3faf3a 100644 (file)
@@ -1,3 +1,8 @@
+2009-11-21  Roland McGrath  <roland@redhat.com>
+
+       * dwarf_getlocation.c (check_constant_offset): Return 1 for all
+       non-constant forms.
+
 2009-10-15  Roland McGrath  <roland@redhat.com>
 
        * libdw_form.c (__libdw_form_val_len): Grok DW_FORM_sec_offset,
index 17df8fe904ad4fca6a9e23ea54995d34981b1147..720b20f4302002a459991a62a5e2a3686cefd5a9 100644 (file)
@@ -154,11 +154,29 @@ static int
 check_constant_offset (Dwarf_Attribute *attr,
                       Dwarf_Op **llbuf, size_t *listlen)
 {
-  if (attr->code != DW_AT_data_member_location
-      || attr->form == DW_FORM_data4
-      || attr->form == DW_FORM_data8)
+  if (attr->code != DW_AT_data_member_location)
     return 1;
 
+  switch (attr->form)
+    {
+      /* Punt for any non-constant form.  */
+    default:
+      return 1;
+
+    case DW_FORM_data1:
+    case DW_FORM_data2:
+    case DW_FORM_sdata:
+    case DW_FORM_udata:
+      break;
+
+    case DW_FORM_data4:
+    case DW_FORM_data8:
+      /* These are loclistptr, not constants.
+        XXX check cu->version > 3???
+      */
+      return 1;
+    }
+
   /* Check whether we already cached this location.  */
   struct loc_s fake = { .addr = attr->valp };
   struct loc_s **found = tfind (&fake, &attr->cu->locs, loc_compare);