This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch 4/9] TUI: Use internally fullname


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]