* dwarf2.c (_bfd_dwarf2_find_nearest_line): Try DWARF3-standard
authorAlexandre Oliva <aoliva@redhat.com>
Wed, 9 Apr 2003 09:56:17 +0000 (09:56 +0000)
committerAlexandre Oliva <aoliva@redhat.com>
Wed, 9 Apr 2003 09:56:17 +0000 (09:56 +0000)
and IRIX-specific shift-to-64-bit 4-byte lengths before following
addr_size.

bfd/ChangeLog
bfd/dwarf2.c

index 075f69bd7e425335a18580801ad7dc3446039932..0fc2206b1ea936ff9e0c97f043712a3259c3c6ea 100644 (file)
@@ -1,3 +1,9 @@
+2003-04-09  Alexandre Oliva  <aoliva@redhat.com>
+
+       * 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  <aoliva@redhat.com>
 
        * elf32-mips.c (bfd_elf32_bfd_reloc_type_lookup): Detect (ctor)
index 8a4cc64b1bd53712c69424076a5e53c34c7ac255..c4a44234c8340a9c097f76c6cd48bc2d649d30e3 100644 (file)
@@ -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)
        {
This page took 0.031881 seconds and 4 git commands to generate.