From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24475 invoked by alias); 22 Jan 2013 07:12:21 -0000 Received: (qmail 24467 invoked by uid 22791); 22 Jan 2013 07:12:20 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 22 Jan 2013 07:12:14 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0M7CCj8022530 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 22 Jan 2013 02:12:12 -0500 Received: from host2.jankratochvil.net (ovpn-116-19.ams2.redhat.com [10.36.116.19]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0M7C6qn004237 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 22 Jan 2013 02:12:09 -0500 Date: Tue, 22 Jan 2013 07:12:00 -0000 From: Jan Kratochvil To: Eli Zaretskii Cc: tromey@redhat.com, gdb-patches@sourceware.org Subject: Re: [patch 4/9] TUI: Use internally fullname Message-ID: <20130122071205.GA31510@host2.jankratochvil.net> References: <20130117215935.GE16249@host2.jankratochvil.net> <87r4le1i04.fsf@fleche.redhat.com> <20130121211121.GA29177@host2.jankratochvil.net> <83mww1ogfl.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83mww1ogfl.fsf@gnu.org> User-Agent: Mutt/1.5.21 (2010-09-15) 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: 2013-01/txt/msg00511.txt.bz2 On Tue, 22 Jan 2013 07:55:10 +0100, Eli Zaretskii wrote: > > Date: Mon, 21 Jan 2013 22:11:21 +0100 > > From: Jan Kratochvil > > Cc: gdb-patches@sourceware.org > > > > - if (compare_filenames_for_search (s->filename, name)) > > + if (compare_filenames_for_search (s->filename, name) > > + || compare_filenames_for_search (symtab_to_fullname (s), name)) > > > > One cannot use just: > > + if (compare_filenames_for_search (symtab_to_fullname (s), name)) > > > > as in the case of S->FILENAME == NAME == "./gdb.base/return.c" it would be > > a regression because SYMTAB_TO_FULLNAME == "/gdb/testsuite/gdb.base/return.c". > > Formerly S->FILENAME matched NAME but SYMTAB_TO_FULLNAME does not match NAME. > > > > One could also do some "normalization" of NAME, one could strip "./" but for > > more complicated cases one cannot do much. > > Why strip it? We could resolve "." to an absolute file name using the > compilation directory, and then they will match, right? That can be done for S->FILENAME and that is already done by symtab_to_fullname. But for NAME - the string which user entered in "break ./gdb.base/return.c:main" - has no compilation nor "current" directory. I think the only perfect solution - which works also for symbolic links and .. references such as in the case: cd gdb ln -s testsuite symlinked then: break symlinked/gdb.base/return.c would be to try resolving the name from each directory of each file being evaluated for a match: /./gdb.base/return.c /gdb/./gdb.base/return.c /gdb/testsuite/./gdb.base/return.c But that would be too slow and I do not think anyone would ever use it. So far I hope this double-match of both s->filename and symtab_to_fullname (s) is good enough for any real world case. > > The next step would be to turn various pathname comparisons rather to > > st_dev&&st_ino comparisons when possible which should be both faster and more > > universal. > > That will break on Windows, unless we replace the library > implementation of 'stat' and 'fstat', or provide a method for > retrieving just the inode and device number (which could be > implemented on Windows using available APIs, such as > GetFileInformationByHandle). I am aware of: separate_debug_file_exists Some operating systems, e.g. Windows, do not provide a meaningful st_ino; they always set it to zero. (Windows does provide a meaningful st_dev.) Do not indicate a duplicate library in that case. While there is no guarantee that a system that provides I expected to fall back to the current realpath strings matching in the MS-Windows ST_INO == 0 case. But when you point at GetFileInformationByHandle I see at http://msdn.microsoft.com/en-us/library/windows/desktop/aa363788%28v=vs.85%29.aspx dwVolumeSerialNumber nFileIndexHigh nFileIndexLow The identifier (low and high parts) and the volume serial number uniquely identify a file on a single computer. To determine whether two open handles represent the same file, combine the identifier and the volume serial number for each file and compare them. So I do not understand why MS-Windows stat call does not provide st_ino from those fields. I expect it is just a MS-Windows stat implementation bug probably workarounded in Cygwin but apparently not in MinGW? Thanks, Jan