This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch/52?] Fix gdb/439 and gdb/291 ?


Hello,

I intend importing the attached patch into the 5.2 branch since, as best as I can tell, it will fix gdb/439 and gdb/291. Can anyone confirm this?

Andrew

2002-06-16  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.

Index: NEWS
===================================================================
RCS file: /cvs/src/src/gdb/NEWS,v
retrieving revision 1.58.2.3
diff -u -r1.58.2.3 NEWS
--- NEWS	16 Jun 2002 14:13:59 -0000	1.58.2.3
+++ NEWS	16 Jun 2002 14:25:56 -0000
@@ -13,6 +13,10 @@
 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: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.54.2.2
diff -u -r1.54.2.2 symfile.c
--- symfile.c	16 Jun 2002 14:13:59 -0000	1.54.2.2
+++ symfile.c	16 Jun 2002 14:25:59 -0000
@@ -539,6 +539,34 @@
   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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]