Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch 4/9] TUI: Use internally fullname
Date: Mon, 21 Jan 2013 21:11:00 -0000	[thread overview]
Message-ID: <20130121211121.GA29177@host2.jankratochvil.net> (raw)
In-Reply-To: <87r4le1i04.fsf@fleche.redhat.com>

On Mon, 21 Jan 2013 19:57:31 +0100, Tom Tromey wrote:
> Jan> -		   && (filename_cmp (src->filename, loc->symtab->filename) == 0)
> Jan> +		   && filename_cmp (src->fullname,
> Jan> +				    symtab_to_fullname (loc->symtab)) == 0
> 
> After your patches is it ever ok to refer directly to symtab->filename?

Originally I thought it almost never will so I had renamed "symtab->filename" as
a private one "symtab->filename_".

Only in rare cases one needed to access "filename_" - for example to fetch the
file extension.  symtab_to_fullname would do the whole expensive realpath
business which has no effect on the file extension (+/- BASENAMES_MAY_DIFFER).

But then I found these cases:
@@ -203,7 +203,8 @@ iterate_over_some_symtabs (const char *name,
-      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.

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.  But that is left as another patchset; which I am not yet decided
to write now.  It would be a fix to this PR, which seems like a nice speedup:
	http://sourceware.org/bugzilla/show_bug.cgi?id=12332


Thanks,
Jan


  reply	other threads:[~2013-01-21 21:11 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 [this message]
2013-01-22  6:55     ` Eli Zaretskii
2013-01-22  7:12       ` Jan Kratochvil
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=20130121211121.GA29177@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --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