From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32017 invoked by alias); 12 Jan 2007 04:02:32 -0000 Received: (qmail 31999 invoked by uid 22791); 12 Jan 2007 04:02:31 -0000 X-Spam-Check-By: sourceware.org Received: from nile.gnat.com (HELO nile.gnat.com) (205.232.38.5) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 12 Jan 2007 04:02:23 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-nile.gnat.com (Postfix) with ESMTP id 615EC48D0DE for ; Thu, 11 Jan 2007 23:02:21 -0500 (EST) Received: from nile.gnat.com ([127.0.0.1]) by localhost (nile.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 17304-01 for ; Thu, 11 Jan 2007 23:02:21 -0500 (EST) Received: from takamaka.act-europe.fr (AStDenis-105-1-2-121.w81-248.abo.wanadoo.fr [81.248.193.121]) by nile.gnat.com (Postfix) with ESMTP id 68EAF48CD9B for ; Thu, 11 Jan 2007 23:02:20 -0500 (EST) Received: by takamaka.act-europe.fr (Postfix, from userid 1000) id 1D2F934C099; Fri, 12 Jan 2007 08:03:10 +0400 (RET) Date: Fri, 12 Jan 2007 04:02:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [RFA] Fix bug in set substitute-patch Message-ID: <20070112040310.GI537@adacore.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="IiVenqGWf+H9Y6IX" Content-Disposition: inline User-Agent: Mutt/1.4.2.2i Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-01/txt/msg00313.txt.bz2 --IiVenqGWf+H9Y6IX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 529 This should fix a bug reported by Daniel when the source file is compiled using absolute filenames. % gcc -c -o foo /path/to/foo.c As Daniel reported, what happens in this case is that the compiler puts the filename full path into the filename, and then leaves the dirname empty. 2007-01-12 Joel Brobecker * source.c (find_and_open_source): Try rewriting the source path inside filename if dirname is NULL. Tested on x86-linux, no regression. OK to apply? Thanks, -- Joel --IiVenqGWf+H9Y6IX Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="subst.diff" Content-length: 888 Index: source.c =================================================================== RCS file: /cvs/src/src/gdb/source.c,v retrieving revision 1.77 diff -u -p -r1.77 source.c --- source.c 9 Jan 2007 17:58:58 -0000 1.77 +++ source.c 12 Jan 2007 04:01:21 -0000 @@ -1001,6 +1001,18 @@ find_and_open_source (struct objfile *ob strcat (path + len, source_path + len + cdir_len); /* After $cdir */ } } + else + { + /* If dirname is NULL, chances are the path is embedded in + the filename. Try the source path substitution on it. */ + char *rewritten_filename = rewrite_source_path (filename); + + if (rewritten_filename != NULL) + { + make_cleanup (xfree, rewritten_filename); + filename = rewritten_filename; + } + } result = openp (path, OPF_SEARCH_IN_PATH, filename, OPEN_MODE, 0, fullname); if (result < 0) --IiVenqGWf+H9Y6IX--