]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* NEWS: Mention below.
authorAndrew Cagney <cagney@redhat.com>
Sat, 22 Jun 2002 16:49:33 +0000 (16:49 +0000)
committerAndrew Cagney <cagney@redhat.com>
Sat, 22 Jun 2002 16:49:33 +0000 (16:49 +0000)
Merge from mainline:
2002-05-12 Fred Fish <fnf@redhat.com>:
* symfile.c (default_symfile_offsets): Arrange for uninitialized
sect_index_xxx members to index the first slot in section_offsets
if all of the section_offsets are zero.

gdb/ChangeLog
gdb/NEWS
gdb/symfile.c

index 69d7778ddd75f54d90345f4057e6fb8101ff4079..5bc9ff712a38d096ad664e1c2a943f8cf2aa4e59 100644 (file)
@@ -1,3 +1,13 @@
+2002-06-22  Andrew Cagney  <ac131313@redhat.com>
+
+       * NEWS: Mention below.
+
+       Merge from mainline:
+       2002-05-12 Fred Fish <fnf@redhat.com>:
+       * symfile.c (default_symfile_offsets): Arrange for uninitialized
+       sect_index_xxx members to index the first slot in section_offsets
+       if all of the section_offsets are zero.
+
 2002-06-20  Elena Zannoni  <ezannoni@redhat.com>
 
         * event-top.c (command_handler): Don't use space_at_cmd_start
index 2e794a2036b32096555ae93b12f10ee1087ada2b..d7c0ad0c15d4efd0d61b40ffcca18bda39abd000 100644 (file)
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -13,6 +13,10 @@ gdb/182: gdb/323: gdb/237: On alpha, gdb was reporting:
 mdebugread.c:2443: gdb-internal-error: sect_index_data not initialized
 Fix, by Joel Brobecker imported from mainline.
 
+gdb/439: gdb/291: On some ELF object files, gdb was reporting:
+dwarf2read.c:1072: gdb-internal-error: sect_index_text not initialize
+Fix, by Fred Fish, imported from mainline.
+
 *** Changes in GDB 5.2:
 
 * New command "set trust-readonly-sections on[off]".
index 8513d34e912ea8f69c10d9379a1b51741326b8cc..c3c18bff153754d5d719f5a4c55d34ce41ab72e7 100644 (file)
@@ -539,6 +539,34 @@ default_symfile_offsets (struct objfile *objfile,
   if (sect) 
     objfile->sect_index_rodata = sect->index;
 
+  /* This is where things get really weird...  We MUST have valid
+     indices for the various sect_index_* members or gdb will abort.
+     So if for example, there is no ".text" section, we have to
+     accomodate that.  Except when explicitly adding symbol files at
+     some address, section_offsets contains nothing but zeros, so it
+     doesn't matter which slot in section_offsets the individual
+     sect_index_* members index into.  So if they are all zero, it is
+     safe to just point all the currently uninitialized indices to the
+     first slot. */
+
+  for (i = 0; i < objfile->num_sections; i++)
+    {
+      if (ANOFFSET (objfile->section_offsets, i) != 0)
+       {
+         break;
+       }
+    }
+  if (i == objfile->num_sections)
+    {
+      if (objfile->sect_index_text == -1)
+       objfile->sect_index_text = 0;
+      if (objfile->sect_index_data == -1)
+       objfile->sect_index_data = 0;
+      if (objfile->sect_index_bss == -1)
+       objfile->sect_index_bss = 0;
+      if (objfile->sect_index_rodata == -1)
+       objfile->sect_index_rodata = 0;
+    }
 }
 
 /* Process a symbol file, as either the main file or as a dynamically