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/symtab.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/symtab.c')
-rw-r--r-- | gdb/symtab.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c index 1628f31..3d94e6b 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -112,6 +112,11 @@ void _initialize_symtab (void); /* */ +/* Non-zero if a file may be known by two different basenames. + This is the uncommon case, and significantly slows down gdb. + Default set to "off" to not slow down the common case. */ +int basenames_may_differ = 0; + /* Allow the user to configure the debugger behavior with respect to multiple-choice menus when more than one symbol matches during a symbol lookup. */ @@ -155,6 +160,7 @@ lookup_symtab (const char *name) char *real_path = NULL; char *full_path = NULL; struct cleanup *cleanup; + const char* base_name = lbasename (name); cleanup = make_cleanup (null_cleanup, NULL); @@ -180,6 +186,12 @@ got_symtab: return s; } + /* 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 (base_name, lbasename (s->filename)) != 0) + continue; + /* If the user gave us an absolute path, try to find the file in this symtab and use its absolute path. */ @@ -4885,5 +4897,19 @@ Show how the debugger handles ambiguities in expressions."), _("\ Valid values are \"ask\", \"all\", \"cancel\", and the default is \"all\"."), NULL, NULL, &setlist, &showlist); + add_setshow_boolean_cmd ("basenames-may-differ", class_obscure, + &basenames_may_differ, _("\ +Set whether a source file may have multiple base names."), _("\ +Show whether a source file may have multiple base names."), _("\ +(A \"base name\" is the name of a file with the directory part removed.\n\ +Example: The base name of \"/home/user/hello.c\" is \"hello.c\".)\n\ +If set, GDB will canonicalize file names (e.g., expand symlinks)\n\ +before comparing them. Canonicalization is an expensive operation,\n\ +but it allows the same file be known by more than one base name.\n\ +If not set (the default), all source files are assumed to have just\n\ +one base name, and gdb will do file name comparisons more efficiently."), + NULL, NULL, + &setlist, &showlist); + observer_attach_executable_changed (symtab_observer_executable_changed); } |