From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8484 invoked by alias); 28 Jun 2004 20:40:35 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 8466 invoked from network); 28 Jun 2004 20:40:33 -0000 Received: from unknown (HELO lakermmtao06.cox.net) (68.230.240.33) by sourceware.org with SMTP; 28 Jun 2004 20:40:33 -0000 Received: from white ([68.9.64.121]) by lakermmtao06.cox.net (InterMail vM.6.01.03.02 201-2131-111-104-20040324) with ESMTP id <20040628204031.RSBZ26998.lakermmtao06.cox.net@white>; Mon, 28 Jun 2004 16:40:31 -0400 Received: from bob by white with local (Exim 3.35 #1 (Debian)) id 1Bf2vX-0000q4-00; Mon, 28 Jun 2004 16:40:31 -0400 Date: Mon, 28 Jun 2004 20:40:00 -0000 From: Bob Rossi To: Andreas Schwab Cc: Elena Zannoni , Eli Zaretskii , gdb-patches@sources.redhat.com Subject: Re: -file-list-exec-source-files Message-ID: <20040628204031.GE2665@white> Mail-Followup-To: Andreas Schwab , Elena Zannoni , Eli Zaretskii , gdb-patches@sources.redhat.com References: <20040306155700.GA9439@white> <20040311132508.GA2504@white> <20040329205545.GA26696@white> <20040405214043.GA2052@white> <20040412150620.GA9464@white> <20040420141001.GB4465@white> <16519.59247.93650.941260@localhost.redhat.com> <20040426130529.GA11975@white> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.28i X-SW-Source: 2004-06/txt/msg00654.txt.bz2 On Sun, Jun 27, 2004 at 08:06:13PM +0200, Andreas Schwab wrote: > Bob Rossi writes: > > > +/* Finds the fullname that a symtab represents. > > + > > + If this functions finds the fullname, it will save it in ps->fullname > > + and it will also return the value. > > > > + If this function fails to find the file that this symtab represents, > > + NULL will be returned and ps->fullname will be set to NULL. */ > > This causes gdb to crash in lookup_symtab. > > if (full_path != NULL) > { > const char *fp = symtab_to_fullname (s); > if (FILENAME_CMP (full_path, fp) == 0) > { > return s; > } > } > > if (real_path != NULL) > { > char *rp = gdb_realpath (symtab_to_fullname (s)); > make_cleanup (xfree, rp); > if (FILENAME_CMP (real_path, rp) == 0) > { > return s; > } > } The patch below checks symtab_to_fullname's return value against NULL. Even though this is the "trivial" fix, I believe it is the correct patch. When I added these calls recently, I blindly changed the old call to symtab_to_fullname, and the old call did not return NULL. Permission to apply? 2004-06-28 Bob Rossi * symtab.c (lookup_symtab): check return value of symtab_to_fullname Index: symtab.c =================================================================== RCS file: /cvs/src/src/gdb/symtab.c,v retrieving revision 1.133 diff -w -u -r1.133 symtab.c --- symtab.c 18 Jun 2004 21:36:15 -0000 1.133 +++ symtab.c 28 Jun 2004 20:36:18 -0000 @@ -182,7 +182,7 @@ if (full_path != NULL) { const char *fp = symtab_to_fullname (s); - if (FILENAME_CMP (full_path, fp) == 0) + if (fp != NULL && FILENAME_CMP (full_path, fp) == 0) { return s; } @@ -190,7 +190,10 @@ if (real_path != NULL) { - char *rp = gdb_realpath (symtab_to_fullname (s)); + char *fullname = symtab_to_fullname (s); + if (fullname != NULL) + { + char *rp = gdb_realpath (fullname); make_cleanup (xfree, rp); if (FILENAME_CMP (real_path, rp) == 0) { @@ -198,6 +201,7 @@ } } } + } /* Now, search for a matching tail (only if name doesn't have any dirs) */