From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5089 invoked by alias); 8 Dec 2005 00:19:42 -0000 Received: (qmail 5070 invoked by uid 22791); 8 Dec 2005 00:19:41 -0000 X-Spam-Check-By: sourceware.org Received: from ip127.bb146.pacific.net.hk (HELO mailhub.stlglobal.com) (202.64.146.127) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 08 Dec 2005 00:19:38 +0000 Received: from 236.193.17.210.dyn.pacific.net.hk ([210.17.193.236] helo=[192.168.1.10]) by mailhub.stlglobal.com with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.50) id 1Ek9VM-0008Gc-0M for gdb-patches@sources.redhat.com; Thu, 08 Dec 2005 08:19:24 +0800 Message-ID: <43977C0C.8060301@tausq.org> Date: Thu, 08 Dec 2005 13:41:00 -0000 From: Randolph Chung User-Agent: Debian Thunderbird 1.0.2 (X11/20050331) MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: [hpux/committed] Fix segfault in SOM section handling Content-Type: multipart/mixed; boundary="------------080605050706070603030901" Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2005-12/txt/msg00143.txt.bz2 This is a multi-part message in MIME format. --------------080605050706070603030901 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 239 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 --------------080605050706070603030901 Content-Type: text/x-patch; name="som.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="som.diff" Content-length: 881 2005-12-08 Randolph Chung * 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; --------------080605050706070603030901--