summaryrefslogtreecommitdiff
path: root/libdw
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2010-06-20 17:25:35 -0700
committerRoland McGrath <roland@redhat.com>2010-06-20 17:25:35 -0700
commit5cc030d6169713ff4711c28a6ce1250b142cd5b3 (patch)
tree812fddfdaac429d454398fcc38e8f45123cc1003 /libdw
parent183e8abb7bce1b51759f1f16529db7f31e3ec705 (diff)
downloadelfutils-5cc030d6169713ff4711c28a6ce1250b142cd5b3.tar.gz
Fix up some holes in .debug_types support.
Diffstat (limited to 'libdw')
-rw-r--r--libdw/ChangeLog8
-rw-r--r--libdw/dwarf_diecu.c10
-rw-r--r--libdw/dwarf_dieoffset.c5
-rw-r--r--libdw/dwarf_formaddr.c4
-rw-r--r--libdw/dwarf_formblock.c7
-rw-r--r--libdw/dwarf_formref_die.c2
-rw-r--r--libdw/libdwP.h2
7 files changed, 19 insertions, 19 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 42a59d11..e446b507 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -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
diff --git a/libdw/dwarf_diecu.c b/libdw/dwarf_diecu.c
index e3e52521..cd98cf61 100644
--- a/libdw/dwarf_diecu.c
+++ b/libdw/dwarf_diecu.c
@@ -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;
diff --git a/libdw/dwarf_dieoffset.c b/libdw/dwarf_dieoffset.c
index 4d712f7f..ac4a84c8 100644
--- a/libdw/dwarf_dieoffset.c
+++ b/libdw/dwarf_dieoffset.c
@@ -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)
diff --git a/libdw/dwarf_formaddr.c b/libdw/dwarf_formaddr.c
index 9938be7e..a8c786ff 100644
--- a/libdw/dwarf_formaddr.c
+++ b/libdw/dwarf_formaddr.c
@@ -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;
diff --git a/libdw/dwarf_formblock.c b/libdw/dwarf_formblock.c
index 6d7b9d39..4eb815c4 100644
--- a/libdw/dwarf_formblock.c
+++ b/libdw/dwarf_formblock.c
@@ -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);
diff --git a/libdw/dwarf_formref_die.c b/libdw/dwarf_formref_die.c
index a684317c..65242586 100644
--- a/libdw/dwarf_formref_die.c
+++ b/libdw/dwarf_formref_die.c
@@ -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))
diff --git a/libdw/libdwP.h b/libdw/libdwP.h
index 14b17498..558f961c 100644
--- a/libdw/libdwP.h
+++ b/libdw/libdwP.h
@@ -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)) \