aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2011-11-15 17:40:02 +0000
committerDoug Evans <dje@google.com>2011-11-15 17:40:02 +0000
commitc011a4f469702871cbd5a1e7fecdb57d322642bd (patch)
treee0a8599b1b433bfba3d377eaea9f106df3e48eda /gdb/dwarf2read.c
parent865ecab4b2b7d6efeaec3072ee843d2d830d2dae (diff)
downloadgdb-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/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 5e5ee7c..5e279de 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2445,7 +2445,8 @@ dw2_lookup_symtab (struct objfile *objfile, const char *name,
struct symtab **result)
{
int i;
- int check_basename = lbasename (name) == name;
+ const char *name_basename = lbasename (name);
+ int check_basename = name_basename == name;
struct dwarf2_per_cu_data *base_cu = NULL;
dw2_setup (objfile);
@@ -2478,6 +2479,12 @@ dw2_lookup_symtab (struct objfile *objfile, const char *name,
&& FILENAME_CMP (lbasename (this_name), name) == 0)
base_cu = per_cu;
+ /* 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 (lbasename (this_name), name_basename) != 0)
+ continue;
+
if (full_path != NULL)
{
const char *this_real_name = dw2_get_real_path (objfile,