]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Fix up some holes in .debug_types support.
authorRoland McGrath <roland@redhat.com>
Mon, 21 Jun 2010 00:25:35 +0000 (17:25 -0700)
committerRoland McGrath <roland@redhat.com>
Mon, 21 Jun 2010 00:25:35 +0000 (17:25 -0700)
libdw/ChangeLog
libdw/dwarf_diecu.c
libdw/dwarf_dieoffset.c
libdw/dwarf_formaddr.c
libdw/dwarf_formblock.c
libdw/dwarf_formref_die.c
libdw/libdwP.h

index 42a59d1116be0fc1e924064ebcde66549d099be0..e446b507efb5b1e2459a67a02f6f30583d3c2d8a 100644 (file)
@@ -1,3 +1,11 @@
+2010-06-20  Roland McGrath  <roland@redhat.com>
+
+       * libdwP.h (CUDIE): Use cu_data.
+       * dwarf_formblock.c: Likewise.
+       * dwarf_formref_die.c: Likewise.
+       * dwarf_diecu.c: Use CUDIE macro.
+       * dwarf_formaddr.c: Use cu_sec_idx.
+
 2010-06-16  Roland McGrath  <roland@redhat.com>
 
        * dwarf_formref_die.c: Use dwarf_offdie only for DW_FORM_ref_addr, so
index e3e5252121bd531028c586902076d88a35a2ac03..cd98cf61e785f9fe15e9c2ec3f73341fe615400e 100644 (file)
@@ -65,15 +65,7 @@ dwarf_diecu (die, result, address_sizep, offset_sizep)
   if (die == NULL)
     return NULL;
 
-  /* Clear the entire DIE structure.  This signals we have not yet
-     determined any of the information.  */
-  memset (result, '\0', sizeof (Dwarf_Die));
-
-  result->addr = ((char *) die->cu->dbg->sectiondata[IDX_debug_info]->d_buf
-                 + DIE_OFFSET_FROM_CU_OFFSET (die->cu->start,
-                                              die->cu->offset_size,
-                                              die->cu->type_offset != 0));
-  result->cu = die->cu;
+  *result = CUDIE (die->cu);
 
   if (address_sizep != NULL)
     *address_sizep = die->cu->address_size;
index 4d712f7f53ec0fd1958f7abc87273fafde21afc0..ac4a84c82139babf6e7be64c6cc8159459f50cc7 100644 (file)
@@ -1,5 +1,5 @@
 /* Return offset of DIE.
-   Copyright (C) 2003, 2005 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.
 
@@ -62,7 +62,6 @@ dwarf_dieoffset (die)
 {
   return (die == NULL
          ? ~0ul
-         : (Dwarf_Off) (die->addr
-                        - die->cu->dbg->sectiondata[IDX_debug_info]->d_buf));
+         : (Dwarf_Off) (die->addr - cu_data (die->cu)->d_buf));
 }
 INTDEF(dwarf_dieoffset)
index 9938be7e2d5621dc214f0ca80c82aee00d195dfc..a8c786ffd65f0bdcef43a6070b62fdaa7ea357c0 100644 (file)
@@ -1,5 +1,5 @@
 /* Return address represented by attribute.
-   Copyright (C) 2003, 2005 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.
 
@@ -71,7 +71,7 @@ dwarf_formaddr (attr, return_addr)
     }
 
   if (__libdw_read_address (attr->cu->dbg,
-                           IDX_debug_info, attr->valp,
+                           cu_sec_idx (attr->cu), attr->valp,
                            attr->cu->address_size, return_addr))
     return -1;
 
index 6d7b9d39775c0f2b4f97daf918dc3781c29966c9..4eb815c4ec186c895454af0ed014017d4a90af0c 100644 (file)
@@ -95,9 +95,10 @@ dwarf_formblock (attr, return_block)
       return -1;
     }
 
-  if (return_block->data + return_block->length
-      > ((unsigned char *) attr->cu->dbg->sectiondata[IDX_debug_info]->d_buf
-        + attr->cu->dbg->sectiondata[IDX_debug_info]->d_size))
+  if (unlikely (cu_data (attr->cu)->d_size
+               - (return_block->data
+                  - (unsigned char *) cu_data (attr->cu)->d_buf)
+               < return_block->length))
     {
       /* Block does not fit.  */
       __libdw_seterrno (DWARF_E_INVALID_DWARF);
index a684317ceb193ce59722e55ae4775cd9dc2830ab..65242586f9e67b9f0735c25377e425b0706eab50 100644 (file)
@@ -114,7 +114,7 @@ dwarf_formref_die (attr, result)
       if (unlikely (__libdw_formref (attr, &offset) != 0))
        return NULL;
 
-      data = cu->dbg->sectiondata[IDX_debug_info];
+      data = cu_data (cu);
     }
 
   if (unlikely (data->d_size - cu->start <= offset))
index 14b17498a1182e1911e851bbfc78226aa5a05fb3..558f961c9b8fde95ebfc5336f9696be1fe951762 100644 (file)
@@ -327,7 +327,7 @@ struct Dwarf_CU
   ((Dwarf_Die)                                                               \
    {                                                                         \
      .cu = (fromcu),                                                         \
-     .addr = ((char *) (fromcu)->dbg->sectiondata[IDX_debug_info]->d_buf      \
+     .addr = ((char *) cu_data (fromcu)->d_buf                               \
              + DIE_OFFSET_FROM_CU_OFFSET ((fromcu)->start,                   \
                                           (fromcu)->offset_size,             \
                                           (fromcu)->type_offset != 0))       \