This is the mail archive of the gdb@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]

Re: [crash] Section index is uninitialized


On Nov 30, 11:26pm, Richard Henderson wrote:

> On Thu, Nov 30, 2000 at 10:40:52PM -0700, Kevin Buettner wrote:
> > The call to fixup_symbol_section() (which is one line before the line
> > indicated above) should be setting section to the section associated
> > with the minimal symbol.  I think we need to find out why
> > fixup_symbol_section() is failing to do this.
> 
> Turns out to be more convoluted than that.  fixup_symbol_section
> is setting the section to that of the minimal symbol.  It's just
> that that is -1 as well.
> 
> More pointers?  Or, if you like, ~rth/gdb-killer in Sunnyvale.

Try the following patch...

	* elfread.c (record_minimal_symbol_and_info): Don't guess
	at the section index to use; just use bfd's index.

Index: elfread.c
===================================================================
RCS file: /cvs/src/src/gdb/elfread.c,v
retrieving revision 1.11
diff -u -p -r1.11 elfread.c
--- elfread.c	2000/08/07 15:02:48	1.11
+++ elfread.c	2000/12/01 08:45:34
@@ -171,32 +171,13 @@ record_minimal_symbol_and_info (char *na
 				enum minimal_symbol_type ms_type, char *info,	/* FIXME, is this really char *? */
 				asection *bfd_section, struct objfile *objfile)
 {
-  int section;
-
-  /* Guess the section from the type.  This is likely to be wrong in
-     some cases.  */
-  switch (ms_type)
-    {
-    case mst_text:
-    case mst_file_text:
-      section = bfd_section->index;
 #ifdef SMASH_TEXT_ADDRESS
-      SMASH_TEXT_ADDRESS (address);
+  if (ms_type == mst_text || ms_type == mst_file_text)
+    SMASH_TEXT_ADDRESS (address);
 #endif
-      break;
-    case mst_data:
-    case mst_file_data:
-    case mst_bss:
-    case mst_file_bss:
-      section = bfd_section->index;
-      break;
-    default:
-      section = -1;
-      break;
-    }
 
   return prim_record_minimal_symbol_and_info
-    (name, address, ms_type, info, section, bfd_section, objfile);
+    (name, address, ms_type, info, bfd_section->index, bfd_section, objfile);
 }
 
 /*


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