diff options
author | Doug Evans <dje@google.com> | 2011-11-15 17:40:02 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2011-11-15 17:40:02 +0000 |
commit | c011a4f469702871cbd5a1e7fecdb57d322642bd (patch) | |
tree | e0a8599b1b433bfba3d377eaea9f106df3e48eda /gdb/psymtab.c | |
parent | 865ecab4b2b7d6efeaec3072ee843d2d830d2dae (diff) | |
download | gdb-c011a4f469702871cbd5a1e7fecdb57d322642bd.zip gdb-c011a4f469702871cbd5a1e7fecdb57d322642bd.tar.gz gdb-c011a4f469702871cbd5a1e7fecdb57d322642bd.tar.bz2 |
* NEWS: Mention new parameter basenames-may-differ.
* dwarf2read.c (dw2_lookup_symtab): Avoid calling gdb_realpath if
! basenames_may_differ.
* psymtab.c (lookup_partial_symtab): Ditto.
* symtab.c (lookup_symtab): Ditto.
(basenames_may_differ): New global.
(_initialize_symtab): New parameter basenames-may-differ.
* symtab.h (basenames_may_differ): Declare.
doc/
* gdb.texinfo (Files): Document basenames-may-differ.
Diffstat (limited to 'gdb/psymtab.c')
-rw-r--r-- | gdb/psymtab.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 6012118..6c4507d 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -134,6 +134,7 @@ lookup_partial_symtab (struct objfile *objfile, const char *name, const char *full_path, const char *real_path) { struct partial_symtab *pst; + const char *name_basename = lbasename (name); ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, pst) { @@ -142,6 +143,12 @@ lookup_partial_symtab (struct objfile *objfile, const char *name, return (pst); } + /* Before we invoke realpath, which can get expensive when many + files are involved, do a quick comparison of the basenames. */ + if (! basenames_may_differ + && FILENAME_CMP (name_basename, lbasename (pst->filename)) != 0) + continue; + /* If the user gave us an absolute path, try to find the file in this symtab and use its absolute path. */ if (full_path != NULL) @@ -172,7 +179,7 @@ lookup_partial_symtab (struct objfile *objfile, const char *name, /* Now, search for a matching tail (only if name doesn't have any dirs). */ - if (lbasename (name) == name) + if (name_basename == name) ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, pst) { if (FILENAME_CMP (lbasename (pst->filename), name) == 0) |