From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12099 invoked by alias); 12 Jan 2007 03:20:33 -0000 Received: (qmail 12086 invoked by uid 22791); 12 Jan 2007 03:20:32 -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 03:20:25 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-nile.gnat.com (Postfix) with ESMTP id CCC8148CEB9 for ; Thu, 11 Jan 2007 22:20:23 -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 18307-01-9 for ; Thu, 11 Jan 2007 22:20:23 -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 DAFD048CBB3 for ; Thu, 11 Jan 2007 22:20:22 -0500 (EST) Received: by takamaka.act-europe.fr (Postfix, from userid 1000) id 44D8234C099; Fri, 12 Jan 2007 07:21:12 +0400 (RET) Date: Fri, 12 Jan 2007 03:20:00 -0000 From: Joel Brobecker To: gdb@sourceware.org Subject: Re: substitute-path problem Message-ID: <20070112032112.GO23012@adacore.com> References: <20070112025149.GA7621@nevyn.them.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Qbvjkv9qwOGw/5Fx" Content-Disposition: inline In-Reply-To: <20070112025149.GA7621@nevyn.them.org> User-Agent: Mutt/1.4.2.2i Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-01/txt/msg00200.txt.bz2 --Qbvjkv9qwOGw/5Fx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1189 > I suspect compiling the file with a full path on the gcc command line > would reproduce this. Do you think we're applying the substitution > rule in the wrong place? I can indeed reproduce. I think that we are just missing one case. First we try the fullpath if we already know it. Then the dirname if we have it. But if there is no dirname, then we should try the filename. Chances are, if the dirname is not specified, the file path is embedded in the filename. I will test the attach patch and commit if all is fine. In the meantim, that might help you out in your work. (I have wondered many times how much easier it would be for us if we resolved the filename+dirname into a fullpath name at debug info reading time, and then only stored that in our data structures - not sure if it is posssible, but if it is, we would be able to assume in the rest of the code that symbol->filename is always a fullpath, or the closest to it we can do based on the information the compiler provided. But I think that would change the behavior of certain things like source file search with the dir path. I'm not completely sure yet, I would have to spend some time researching this) -- Joel --Qbvjkv9qwOGw/5Fx Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="subst.diff" Content-length: 753 Index: source.c =================================================================== RCS file: /cvs/src/src/gdb/source.c,v retrieving revision 1.76 diff -u -p -r1.76 source.c --- source.c 8 Aug 2006 22:06:06 -0000 1.76 +++ source.c 12 Jan 2007 03:15:55 -0000 @@ -1001,6 +1001,16 @@ find_and_open_source (struct objfile *ob strcat (path + len, source_path + len + cdir_len); /* After $cdir */ } } + else + { + 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) --Qbvjkv9qwOGw/5Fx--