From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18966 invoked by alias); 7 Feb 2008 17:47:08 -0000 Received: (qmail 18958 invoked by uid 22791); 7 Feb 2008 17:47:08 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 07 Feb 2008 17:46:48 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 0FB3898300; Thu, 7 Feb 2008 17:46:47 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id E22BE9829D; Thu, 7 Feb 2008 17:46:46 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.68) (envelope-from ) id 1JNAph-00058w-9u; Thu, 07 Feb 2008 12:46:45 -0500 Date: Thu, 07 Feb 2008 17:47:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sourceware.org Cc: dje@google.com Subject: [rfc] Use substitute-path for filename portion too Message-ID: <20080207174645.GA19452@caradoc.them.org> Mail-Followup-To: gdb-patches@sourceware.org, dje@google.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.17 (2007-12-11) X-IsSubscribed: yes 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: 2008-02/txt/msg00130.txt.bz2 I borrowed this bit from Doug's work on canonicalizing filenames last month. We ended up without that patch, but does anyone see a problem with just this part? This handles the symtabs created by the DWARF-2 reader for header files in subdirectories. For instance, if you have /opt/codesourcery/foo.c which includes /opt/codesourcery/bar/bar.h, and the current source line is in bar.h, find_and_open_source will be called with dirname "/opt/codesourcery" and filename "/opt/codesourcery/bar/bar.h". We rewrote /opt/codesourcery but not /opt/codesourcery/bar/bar.h, and ended up searching a number of silly places for the filename but not the place it was actually located. -- Daniel Jacobowitz CodeSourcery 2008-02-07 Doug Evans * source.c (find_and_open_source): Always rewrite absolute filenames. Index: source.c =================================================================== RCS file: /cvs/src/src/gdb/source.c,v retrieving revision 1.83 diff -u -p -r1.83 source.c --- source.c 1 Jan 2008 22:53:13 -0000 1.83 +++ source.c 7 Feb 2008 16:09:34 -0000 @@ -999,10 +999,11 @@ find_and_open_source (struct objfile *ob strcat (path + len, source_path + len + cdir_len); /* After $cdir */ } } - else + + if (IS_ABSOLUTE_PATH (filename)) { - /* If dirname is NULL, chances are the path is embedded in - the filename. Try the source path substitution on it. */ + /* If filename is absolute path, try the source path + substitution on it. */ char *rewritten_filename = rewrite_source_path (filename); if (rewritten_filename != NULL)