Avoid extra work in global_symbol_searcher::expand_symtabs
I noticed that global_symbol_searcher::expand_symtabs always passes a file matcher to expand_symtabs_matching. However, if 'filenames' is empty, then this always returns true. It's slightly more efficient to pass a null file matcher in this case, because that lets the "quick" symbol implementations skip any filename checks. Regression tested on x86-64 Fedora 34.
This commit is contained in:
parent
4281b0c8fc
commit
c5a9fcdfee
1 changed files with 9 additions and 4 deletions
13
gdb/symtab.c
13
gdb/symtab.c
|
@ -4678,11 +4678,16 @@ global_symbol_searcher::expand_symtabs
|
||||||
enum search_domain kind = m_kind;
|
enum search_domain kind = m_kind;
|
||||||
bool found_msymbol = false;
|
bool found_msymbol = false;
|
||||||
|
|
||||||
|
auto do_file_match = [&] (const char *filename, bool basenames)
|
||||||
|
{
|
||||||
|
return file_matches (filename, filenames, basenames);
|
||||||
|
};
|
||||||
|
gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher = nullptr;
|
||||||
|
if (!filenames.empty ())
|
||||||
|
file_matcher = do_file_match;
|
||||||
|
|
||||||
objfile->expand_symtabs_matching
|
objfile->expand_symtabs_matching
|
||||||
([&] (const char *filename, bool basenames)
|
(file_matcher,
|
||||||
{
|
|
||||||
return file_matches (filename, filenames, basenames);
|
|
||||||
},
|
|
||||||
&lookup_name_info::match_any (),
|
&lookup_name_info::match_any (),
|
||||||
[&] (const char *symname)
|
[&] (const char *symname)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue