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

[hpux/committed] Fix segfault in SOM section handling


On 32-bit hpux we were not properly reading symfiles and iterating over sections that don't exist. This caused segfaults when, for example, we try to debug gdb with itself. Fixed with the attached patch. committed as obvious.

randolph
2005-12-08  Randolph Chung  <tausq@debian.org>

	* somread.c (som_symfile_offsets): Iterate through number of sections
	in addrs instead of objfile.

Index: somread.c
===================================================================
RCS file: /cvs/src/src/gdb/somread.c,v
retrieving revision 1.27
diff -u -p -r1.27 somread.c
--- somread.c	11 Feb 2005 04:06:05 -0000	1.27
+++ somread.c	8 Dec 2005 00:10:21 -0000
@@ -442,7 +440,7 @@ som_symfile_offsets (struct objfile *obj
       /* Note: Here is OK to compare with ".text" because this is the
          name that gdb itself gives to that section, not the SOM
          name. */
-      for (i = 0; i < objfile->num_sections && addrs->other[i].name; i++)
+      for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++)
 	if (strcmp (addrs->other[i].name, ".text") == 0)
 	  break;
       text_addr = addrs->other[i].addr;

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