From: Tom Tromey Date: Thu, 4 Mar 2010 22:01:10 +0000 (+0000) Subject: * dwarf2read.c (skip_one_die) : Use offset size X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ae4114972997ac939791195c8cc33ca7e4eaeadc;p=binutils-gdb.git * dwarf2read.c (skip_one_die) : Use offset size in DWARF 3 and later. (read_attribute_value) : Likewise. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a44b03afce6..ccb69032eec 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2010-03-04 Tom Tromey + + * dwarf2read.c (skip_one_die) : Use offset size + in DWARF 3 and later. + (read_attribute_value) : Likewise. + 2010-03-04 Keith Seitz * linespec.c (decode_line_1): Update comments for is_quote_enclosed. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 549d2c0add8..b144dc16d82 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;