This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH/SPARC] Merge bugfix from mainline
- From: Mark Kettenis <kettenis at chello dot nl>
- To: gdb-patches at sources dot redhat dot com
- Date: Sat, 27 Dec 2003 14:52:54 +0100 (CET)
- Subject: [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);