From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2197 invoked by alias); 3 Jan 2008 16:00:38 -0000 Received: (qmail 2186 invoked by uid 22791); 3 Jan 2008 16:00:38 -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, 03 Jan 2008 15:55:52 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 3AA8D98120; Thu, 3 Jan 2008 15:55:37 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 055429811F; Thu, 3 Jan 2008 15:55:37 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.68) (envelope-from ) id 1JASPv-0003LJ-S0; Thu, 03 Jan 2008 10:55:35 -0500 Date: Thu, 03 Jan 2008 16:00:00 -0000 From: Daniel Jacobowitz To: Aleksandar Ristovski Cc: gdb@sourceware.org, Ryan Mansfield Subject: Re: gdb_realpath: dealing with ./ and ../ Message-ID: <20080103155535.GA10512@caradoc.them.org> Mail-Followup-To: Aleksandar Ristovski , gdb@sourceware.org, Ryan Mansfield References: <2F6320727174C448A52CEB63D85D11F40A3C@nova.ott.qnx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2F6320727174C448A52CEB63D85D11F40A3C@nova.ott.qnx.com> User-Agent: Mutt/1.5.17 (2007-12-11) X-IsSubscribed: yes 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: 2008-01/txt/msg00008.txt.bz2 On Thu, Jan 03, 2008 at 10:20:19AM -0500, Aleksandar Ristovski wrote: > Hello, > > First a question, to give an idea what I am talking about and then detailed > explanation. > > Question: Should gdb_realpath deal with './' and '../' path elements and > compact them along with 'canonicalization' it already does? The problem with this idea is that removing ../ is not reliably correct. On Unix, symlinks allow foo/../bar and bar to be different directories. We should only canonicalize paths to local files, not to files mentioned in debug information. gdb_realpath shouldn't need any changes to handle ..; it works from the local filesystem and constructs a real canonical path. I see that you're on Windows. gdb_realpath may not handle Windows correctly; libiberty's lrealpath does and I don't know why we still have both. > When our cross-compiler generates binary, it stores relative path in > .debug_line section (relative to compilation dir), i.e. '..'. What's in .debug_info? Also, what version of GDB? > It loads line table, finds '..', constructs absolute path using compilation > directory and creates "C:/foo/bar/Debug/../main.cc" and then compares this > (using FILENAME_CMP macro) to existing subfile-s and fails to find it (file > buildsym.c, function start_subfile). I have: <0><154>: Abbrev Number: 1 (DW_TAG_compile_unit) <189> DW_AT_name : ../main.c <193> DW_AT_comp_dir : /home/drow/z/baz The Directory Table: .. The File Name Table: Entry Dir Time Size Name 1 1 0 0 main.c So everything constructs the same /home/drow/z/baz/../main.c. -- Daniel Jacobowitz CodeSourcery