Fix DW_FORM_sec_offset handling.
authorRoland McGrath <roland@redhat.com>
Wed, 2 Jun 2010 02:05:08 +0000 (19:05 -0700)
committerRoland McGrath <roland@redhat.com>
Wed, 2 Jun 2010 02:05:08 +0000 (19:05 -0700)
libdw/ChangeLog
libdw/dwarf_formudata.c

index 6712abf..2fca3ea 100644 (file)
@@ -1,5 +1,7 @@
 2010-06-01  Roland McGrath  <roland@redhat.com>
 
+       * dwarf_formudata.c (__libdw_formptr): Fix DW_FORM_sec_offset handling.
+
        * dwarf_formblock.c (dwarf_formblock): Handle DW_FORM_exprloc.
 
        * libdw_findcu.c (__libdw_findcu): Accept version 4.
index d9d0a1c..63c9bcd 100644 (file)
@@ -1,5 +1,5 @@
 /* Return unsigned constant represented by attribute.
-   Copyright (C) 2003-2009 Red Hat, Inc.
+   Copyright (C) 2003-2010 Red Hat, Inc.
    This file is part of Red Hat elfutils.
    Written by Ulrich Drepper <drepper@redhat.com>, 2003.
 
@@ -79,21 +79,21 @@ __libdw_formptr (Dwarf_Attribute *attr, int sec_index,
     }
   else if (attr->cu->version > 3)
     goto invalid;
-
-  switch (attr->form)
-    {
-    case DW_FORM_data4:
-    case DW_FORM_data8:
-      if (__libdw_read_offset (attr->cu->dbg, IDX_debug_info, attr->valp,
-                              attr->form == DW_FORM_data4 ? 4 : 8,
-                              &offset, sec_index, 0))
-       return NULL;
-      break;
-
-    default:
-      if (INTUSE(dwarf_formudata) (attr, &offset))
-       return NULL;
-    };
+  else
+    switch (attr->form)
+      {
+      case DW_FORM_data4:
+      case DW_FORM_data8:
+       if (__libdw_read_offset (attr->cu->dbg, IDX_debug_info, attr->valp,
+                                attr->form == DW_FORM_data4 ? 4 : 8,
+                                &offset, sec_index, 0))
+         return NULL;
+       break;
+
+      default:
+       if (INTUSE(dwarf_formudata) (attr, &offset))
+         return NULL;
+      };
 
   unsigned char *readp = d->d_buf + offset;
   unsigned char *endp = d->d_buf + d->d_size;