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/SPARC] Merge bugfix from mainline


Looks like this is needed on SPARC Solaris when using the SUN
compiler.  Otherwise GDB will crash upon reading the symbol table.

Committed to the SPARC branch.

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>
 
	Merge from mainline:

	2003-10-31  Jim Blandy  <jimb@redhat.com>

	* elfread.c (elf_symtab_read): Allocate correct number of tail
	elements to sectinfo structure.  (Fix from Woody LaRue.)

Index: elfread.c
===================================================================
RCS file: /cvs/src/src/gdb/elfread.c,v
retrieving revision 1.35
diff -u -p -r1.35 elfread.c
--- elfread.c 14 Sep 2003 16:32:12 -0000 1.35
+++ elfread.c 27 Dec 2003 13:49:52 -0000
@@ -398,9 +398,17 @@ elf_symtab_read (struct objfile *objfile
 				= max (SECT_OFF_BSS (objfile),
 				       max (SECT_OFF_DATA (objfile),
 					    SECT_OFF_RODATA (objfile)));
+
+                              /* max_index is the largest index we'll
+                                 use into this array, so we must
+                                 allocate max_index+1 elements for it.
+                                 However, 'struct stab_section_info'
+                                 already includes one element, so we
+                                 need to allocate max_index aadditional
+                                 elements.  */
 			      size = (sizeof (struct stab_section_info) 
 				      + (sizeof (CORE_ADDR)
-					 * (max_index - 1)));
+					 * max_index));
 			      sectinfo = (struct stab_section_info *)
 				xmmalloc (objfile->md, size);
 			      memset (sectinfo, 0, size);


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