aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/dwarf2read.c17
2 files changed, 21 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a44b03a..ccb6903 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2010-03-04 Tom Tromey <tromey@redhat.com>
+
+ * dwarf2read.c (skip_one_die) <DW_FORM_ref_addr>: Use offset size
+ in DWARF 3 and later.
+ (read_attribute_value) <DW_FORM_ref_addr>: Likewise.
+
2010-03-04 Keith Seitz <keiths@redhat.com>
* linespec.c (decode_line_1): Update comments for is_quote_enclosed.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 549d2c0..b144dc1 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2882,8 +2882,15 @@ skip_one_die (gdb_byte *buffer, gdb_byte *info_ptr,
skip_attribute:
switch (form)
{
- case DW_FORM_addr:
case DW_FORM_ref_addr:
+ /* In DWARF 2, DW_FORM_ref_addr is address sized; in DWARF 3
+ and later it is offset sized. */
+ if (cu->header.version == 2)
+ info_ptr += cu->header.addr_size;
+ else
+ info_ptr += cu->header.offset_size;
+ break;
+ case DW_FORM_addr:
info_ptr += cu->header.addr_size;
break;
case DW_FORM_data1:
@@ -7017,8 +7024,14 @@ read_attribute_value (struct attribute *attr, unsigned form,
attr->form = form;
switch (form)
{
- case DW_FORM_addr:
case DW_FORM_ref_addr:
+ if (cu->header.version == 2)
+ DW_ADDR (attr) = read_address (abfd, info_ptr, cu, &bytes_read);
+ else
+ DW_ADDR (attr) = read_offset (abfd, info_ptr, &cu->header, &bytes_read);
+ info_ptr += bytes_read;
+ break;
+ case DW_FORM_addr:
DW_ADDR (attr) = read_address (abfd, info_ptr, cu, &bytes_read);
info_ptr += bytes_read;
break;