Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: tromey@redhat.com, gdb-patches@sourceware.org
Subject: Re: [patch 4/9] TUI: Use internally fullname
Date: Tue, 22 Jan 2013 07:12:00 -0000	[thread overview]
Message-ID: <20130122071205.GA31510@host2.jankratochvil.net> (raw)
In-Reply-To: <83mww1ogfl.fsf@gnu.org>

On Tue, 22 Jan 2013 07:55:10 +0100, Eli Zaretskii wrote:
> > Date: Mon, 21 Jan 2013 22:11:21 +0100
> > From: Jan Kratochvil <jan.kratochvil@redhat.com>
> > 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


  reply	other threads:[~2013-01-22  7:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-17 21:59 Jan Kratochvil
2013-01-21 18:57 ` Tom Tromey
2013-01-21 21:11   ` Jan Kratochvil
2013-01-22  6:55     ` Eli Zaretskii
2013-01-22  7:12       ` Jan Kratochvil [this message]
2013-01-22  8:24         ` Eli Zaretskii
2013-01-22  8:47           ` Jan Kratochvil
2013-01-22 11:44             ` Eli Zaretskii
2013-01-22 12:05               ` Jan Kratochvil
2013-01-22 13:23                 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130122071205.GA31510@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox