From a3805e4e10604d5d9b469949d6141c5935d9275c Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Wed, 9 Apr 2003 09:56:17 +0000 Subject: * dwarf2.c (_bfd_dwarf2_find_nearest_line): Try DWARF3-standard and IRIX-specific shift-to-64-bit 4-byte lengths before following addr_size. --- bfd/ChangeLog | 6 ++++++ bfd/dwarf2.c | 42 +++++++++++++++++++++++++----------------- 2 files changed, 31 insertions(+), 17 deletions(-) (limited to 'bfd') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 075f69b..0fc2206 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2003-04-09 Alexandre Oliva + + * dwarf2.c (_bfd_dwarf2_find_nearest_line): Try DWARF3-standard + and IRIX-specific shift-to-64-bit 4-byte lengths before following + addr_size. + 2003-04-08 Alexandre Oliva * elf32-mips.c (bfd_elf32_bfd_reloc_type_lookup): Detect (ctor) diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index 8a4cc64..c4a4423 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -1927,26 +1927,34 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, bfd_boolean found; unsigned int offset_size = addr_size; - if (addr_size == 4) + length = read_4_bytes (abfd, stash->info_ptr); + /* A 0xffffff length is the DWARF3 way of indicating we use + 64-bit offsets, instead of 32-bit offsets. */ + if (length == 0xffffffff) { - length = read_4_bytes (abfd, stash->info_ptr); - if (length == 0xffffffff) - { - offset_size = 8; - length = read_8_bytes (abfd, stash->info_ptr + 4); - stash->info_ptr += 8; - } - else if (length == 0) - { - /* Handle (non-standard) 64-bit DWARF2 formats. */ - offset_size = 8; - length = read_4_bytes (abfd, stash->info_ptr + 4); - stash->info_ptr += 4; - } + offset_size = 8; + length = read_8_bytes (abfd, stash->info_ptr + 4); + stash->info_ptr += 12; + } + /* A zero length is the IRIX way of indicating 64-bit offsets, + mostly because the 64-bit length will generally fit in 32 + bits, and the endianness helps. */ + else if (length == 0) + { + offset_size = 8; + length = read_4_bytes (abfd, stash->info_ptr + 4); + stash->info_ptr += 8; + } + /* In the absence of the hints above, we assume addr_size-sized + offsets, for backward-compatibility with pre-DWARF3 64-bit + platforms. */ + else if (addr_size == 8) + { + length = read_8_bytes (abfd, stash->info_ptr); + stash->info_ptr = 8; } else - length = read_8_bytes (abfd, stash->info_ptr); - stash->info_ptr += addr_size; + stash->info_ptr += 4; if (length > 0) { -- cgit v1.1