domain, data);
};
- objfile->expand_symtabs_matching (nullptr, &lookup_name,
- nullptr, callback,
- global
- ? SEARCH_GLOBAL_BLOCK
- : SEARCH_STATIC_BLOCK,
- domain);
+ objfile->search (nullptr, &lookup_name, nullptr, callback,
+ global ? SEARCH_GLOBAL_BLOCK : SEARCH_STATIC_BLOCK,
+ domain);
}
/* Add to RESULT all non-local symbols whose name and domain match
the regular expression used to do the matching refers to the
natural name. So match against the decoded name. */
auto any = lookup_name_info::match_any ();
- objfile->expand_symtabs_matching
+ objfile->search
(nullptr,
&any,
[&] (const char *search_name)
return true;
};
- objfile->expand_symtabs_matching
+ objfile->search
(nullptr, &lookup_name, nullptr, callback,
SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
SEARCH_ALL_DOMAINS);
/* Look through the partial symtabs for all symbols which
begin by matching FUNC_NAME. Make sure we read that
symbol table in. */
- obj->expand_symtabs_matching (nullptr, &lookup_name,
- nullptr, callback,
- (SEARCH_GLOBAL_BLOCK
- | SEARCH_STATIC_BLOCK),
- SEARCH_FUNCTION_DOMAIN);
+ obj->search (nullptr, &lookup_name, nullptr, callback,
+ SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
+ SEARCH_FUNCTION_DOMAIN);
return 0;
}, current_objfile);
dwarf2_base_index_functions::expand_all_symtabs (objfile);
}
- bool expand_symtabs_matching
+ bool search
(struct objfile *objfile,
- expand_symtabs_file_matcher file_matcher,
+ search_symtabs_file_matcher file_matcher,
const lookup_name_info *lookup_name,
- expand_symtabs_symbol_matcher symbol_matcher,
- expand_symtabs_expansion_listener expansion_notify,
+ search_symtabs_symbol_matcher symbol_matcher,
+ search_symtabs_expansion_listener listener,
block_search_flags search_flags,
domain_search_flags domain,
- expand_symtabs_lang_matcher lang_matcher) override;
+ search_symtabs_lang_matcher lang_matcher) override;
struct compunit_symtab *find_pc_sect_compunit_symtab
(struct objfile *objfile, bound_minimal_symbol msymbol,
static struct dwarf2_section_info *cu_debug_rnglists_section
(struct dwarf2_cu *cu, dwarf_tag tag);
-static void dw_expand_symtabs_matching_file_matcher
+static void dw_search_file_matcher
(dwarf2_per_objfile *per_objfile,
auto_bool_vector &cus_to_skip,
- expand_symtabs_file_matcher file_matcher);
+ search_symtabs_file_matcher file_matcher);
static void get_scope_pc_bounds (struct die_info *,
unrelocated_addr *, unrelocated_addr *,
{
}
- bool expand_symtabs_matching
- (struct objfile *objfile,
- expand_symtabs_file_matcher file_matcher,
- const lookup_name_info *lookup_name,
- expand_symtabs_symbol_matcher symbol_matcher,
- expand_symtabs_expansion_listener expansion_notify,
- block_search_flags search_flags,
- domain_search_flags domain,
- expand_symtabs_lang_matcher lang_matcher) override
+ bool search (struct objfile *objfile,
+ search_symtabs_file_matcher file_matcher,
+ const lookup_name_info *lookup_name,
+ search_symtabs_symbol_matcher symbol_matcher,
+ search_symtabs_expansion_listener listener,
+ block_search_flags search_flags,
+ domain_search_flags domain,
+ search_symtabs_lang_matcher lang_matcher) override
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
auto_bool_vector cus_to_skip;
- dw_expand_symtabs_matching_file_matcher (per_objfile, cus_to_skip,
- file_matcher);
+ dw_search_file_matcher (per_objfile, cus_to_skip, file_matcher);
for (const auto &per_cu : per_objfile->per_bfd->all_units)
{
|| per_cu->unit_type (false) == 0
|| per_objfile->get_symtab (per_cu.get ()) == nullptr)
continue;
- if (!dw2_expand_symtabs_matching_one (per_cu.get (), per_objfile,
- cus_to_skip, file_matcher,
- expansion_notify,
- lang_matcher))
+ if (!dw2_search_one (per_cu.get (), per_objfile, cus_to_skip,
+ file_matcher, listener, lang_matcher))
return false;
}
return true;
/* See read.h. */
bool
-dw2_expand_symtabs_matching_one
+dw2_search_one
(dwarf2_per_cu *per_cu,
dwarf2_per_objfile *per_objfile,
auto_bool_vector &cus_to_skip,
- expand_symtabs_file_matcher file_matcher,
- expand_symtabs_expansion_listener expansion_notify,
- expand_symtabs_lang_matcher lang_matcher)
+ search_symtabs_file_matcher file_matcher,
+ search_symtabs_expansion_listener listener,
+ search_symtabs_lang_matcher lang_matcher)
{
/* Already visited, or intentionally skipped. */
if (cus_to_skip.is_set (per_cu->index))
= dw2_instantiate_symtab (per_cu, per_objfile, false);
gdb_assert (symtab != nullptr);
- if (expansion_notify != nullptr)
+ if (listener != nullptr)
{
cus_to_skip.set (per_cu->index, true);
- return expansion_notify (symtab);
+ return listener (symtab);
}
return true;
based on FILE_MATCHER. */
static void
-dw_expand_symtabs_matching_file_matcher
+dw_search_file_matcher
(dwarf2_per_objfile *per_objfile,
auto_bool_vector &cus_to_skip,
- expand_symtabs_file_matcher file_matcher)
+ search_symtabs_file_matcher file_matcher)
{
if (file_matcher == NULL)
return;
}
bool
-cooked_index_functions::expand_symtabs_matching
+cooked_index_functions::search
(objfile *objfile,
- expand_symtabs_file_matcher file_matcher,
+ search_symtabs_file_matcher file_matcher,
const lookup_name_info *lookup_name,
- expand_symtabs_symbol_matcher symbol_matcher,
- expand_symtabs_expansion_listener expansion_notify,
+ search_symtabs_symbol_matcher symbol_matcher,
+ search_symtabs_expansion_listener listener,
block_search_flags search_flags,
domain_search_flags domain,
- expand_symtabs_lang_matcher lang_matcher)
+ search_symtabs_lang_matcher lang_matcher)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
cooked_index *table = wait (objfile, true);
auto_bool_vector cus_to_skip;
- dw_expand_symtabs_matching_file_matcher (per_objfile, cus_to_skip,
- file_matcher);
+ dw_search_file_matcher (per_objfile, cus_to_skip, file_matcher);
/* This invariant is documented in quick-functions.h. */
gdb_assert (lookup_name != nullptr || symbol_matcher == nullptr);
{
QUIT;
- if (!dw2_expand_symtabs_matching_one (per_cu, per_objfile,
- cus_to_skip, file_matcher,
- expansion_notify,
- lang_matcher))
+ if (!dw2_search_one (per_cu, per_objfile, cus_to_skip, file_matcher,
+ listener, lang_matcher))
return false;
}
return true;
else if (!symbol_matcher (full_name))
continue;
- if (!dw2_expand_symtabs_matching_one (entry->per_cu, per_objfile,
- cus_to_skip, file_matcher,
- expansion_notify, nullptr))
+ if (!dw2_search_one (entry->per_cu, per_objfile, cus_to_skip,
+ file_matcher, listener, nullptr))
return false;
}
}
};
/* If FILE_MATCHER is NULL and if CUS_TO_SKIP does not include the
- CU's index, expand the CU and call EXPANSION_NOTIFY on it. */
+ CU's index, expand the CU and call LISTENER on it. */
-extern bool dw2_expand_symtabs_matching_one
+extern bool dw2_search_one
(dwarf2_per_cu *per_cu,
dwarf2_per_objfile *per_objfile,
auto_bool_vector &cus_to_skip,
- expand_symtabs_file_matcher file_matcher,
- expand_symtabs_expansion_listener expansion_notify,
- expand_symtabs_lang_matcher lang_matcher);
+ search_symtabs_file_matcher file_matcher,
+ search_symtabs_expansion_listener listener,
+ search_symtabs_lang_matcher lang_matcher);
/* Return pointer to string at .debug_str offset STR_OFFSET. */
return true;
};
- objfile->expand_symtabs_matching (nullptr, &lookup_name,
- nullptr, expand_callback,
- (SEARCH_GLOBAL_BLOCK
- | SEARCH_STATIC_BLOCK),
- domain);
+ objfile->search (nullptr, &lookup_name, nullptr, expand_callback,
+ SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK, domain);
}
}
}
if (canon != nullptr)
lookup_name = canon.get ();
- /* It's important to not call expand_symtabs_matching unnecessarily
+ /* It's important to not call search unnecessarily
as it can really slow things down (by unnecessarily expanding
potentially 1000s of symtabs, which when debugging some apps can
cost 100s of seconds). Avoid this to some extent by *first* calling
void expand_symtabs_with_fullname (const char *fullname);
/* See quick_symbol_functions. */
- bool expand_symtabs_matching
- (expand_symtabs_file_matcher file_matcher,
+ bool search
+ (search_symtabs_file_matcher file_matcher,
const lookup_name_info *lookup_name,
- expand_symtabs_symbol_matcher symbol_matcher,
- expand_symtabs_expansion_listener expansion_notify,
+ search_symtabs_symbol_matcher symbol_matcher,
+ search_symtabs_expansion_listener listener,
block_search_flags search_flags,
domain_search_flags domain,
- expand_symtabs_lang_matcher lang_matcher = nullptr);
+ search_symtabs_lang_matcher lang_matcher = nullptr);
/* See quick_symbol_functions. */
struct compunit_symtab *
return ps->fullname;
}
-/* A helper for psym_expand_symtabs_matching that handles searching
+/* A helper for psymbol_functions::search that handles searching
included psymtabs. This returns true if a symbol is found, and
false otherwise. It also updates the 'searched_flag' on the
various psymtabs that it searches. */
block_search_flags search_flags,
domain_search_flags domain,
const lookup_name_info &lookup_name,
- expand_symtabs_symbol_matcher sym_matcher)
+ search_symtabs_symbol_matcher sym_matcher)
{
int keep_going = 1;
enum psymtab_search_status result = PST_SEARCHED_AND_NOT_FOUND;
return result == PST_SEARCHED_AND_FOUND;
}
-/* Psymtab version of expand_symtabs_matching. See its definition in
+/* Psymtab version of search. See its definition in
the definition of quick_symbol_functions in symfile.h. */
bool
-psymbol_functions::expand_symtabs_matching
+psymbol_functions::search
(struct objfile *objfile,
- expand_symtabs_file_matcher file_matcher,
+ search_symtabs_file_matcher file_matcher,
const lookup_name_info *lookup_name,
- expand_symtabs_symbol_matcher symbol_matcher,
- expand_symtabs_expansion_listener expansion_notify,
+ search_symtabs_symbol_matcher symbol_matcher,
+ search_symtabs_expansion_listener listener,
block_search_flags search_flags,
domain_search_flags domain,
- expand_symtabs_lang_matcher lang_matcher ATTRIBUTE_UNUSED)
+ search_symtabs_lang_matcher lang_matcher ATTRIBUTE_UNUSED)
{
/* Clear the search flags. */
for (partial_symtab *ps : partial_symbols (objfile))
{
compunit_symtab *cust = psymtab_to_symtab (objfile, ps);
- if (cust != nullptr && expansion_notify != nullptr)
- if (!expansion_notify (cust))
+ if (cust != nullptr && listener != nullptr)
+ if (!listener (cust))
return false;
}
}
void expand_all_symtabs (struct objfile *objfile) override;
- bool expand_symtabs_matching
+ bool search
(struct objfile *objfile,
- expand_symtabs_file_matcher file_matcher,
+ search_symtabs_file_matcher file_matcher,
const lookup_name_info *lookup_name,
- expand_symtabs_symbol_matcher symbol_matcher,
- expand_symtabs_expansion_listener expansion_notify,
+ search_symtabs_symbol_matcher symbol_matcher,
+ search_symtabs_expansion_listener listener,
block_search_flags search_flags,
domain_search_flags kind,
- expand_symtabs_lang_matcher lang_matcher) override;
+ search_symtabs_lang_matcher lang_matcher) override;
struct compunit_symtab *find_pc_sect_compunit_symtab
(struct objfile *objfile, bound_minimal_symbol msymbol, CORE_ADDR pc,
return true;
};
- if (!objfile->expand_symtabs_matching
- (nullptr, &lookup_name, nullptr, callback,
- SEARCH_STATIC_BLOCK, flags))
+ if (!objfile->search (nullptr, &lookup_name, nullptr, callback,
+ SEARCH_STATIC_BLOCK, flags))
return nullptr;
}
}
using symbol_filename_listener
= gdb::function_view<void (const char *filename, const char *fullname)>;
-/* Callback for quick_symbol_functions::expand_symtabs_matching
- to match a file name. */
+/* Callback for quick_symbol_functions::search to match a file
+ name. */
-using expand_symtabs_file_matcher
+using search_symtabs_file_matcher
= gdb::function_view<bool (const char *filename, bool basenames)>;
-/* Callback for quick_symbol_functions::expand_symtabs_matching
- to match a symbol name. */
+/* Callback for quick_symbol_functions::search to match a symbol
+ name. */
-using expand_symtabs_symbol_matcher
+using search_symtabs_symbol_matcher
= gdb::function_view<bool (const char *name)>;
-/* Callback for quick_symbol_functions::expand_symtabs_matching
- to match a language. */
+/* Callback for quick_symbol_functions::search to match a
+ language. */
-using expand_symtabs_lang_matcher
+using search_symtabs_lang_matcher
= gdb::function_view<bool (enum language lang)>;
-/* Callback for quick_symbol_functions::expand_symtabs_matching
- to be called after a symtab has been expanded. If this returns
- true, more symtabs are checked; if it returns false, iteration
- stops. */
+/* Callback for quick_symbol_functions::search to be called when
+ symtab matches (perhaps expanding it first). If this returns true,
+ more symtabs are checked; if it returns false, iteration stops. */
-using expand_symtabs_expansion_listener
+using search_symtabs_expansion_listener
= gdb::function_view<bool (compunit_symtab *symtab)>;
/* The "quick" symbol functions exist so that symbol readers can
The quick symbol functions are generally opaque: the underlying
representation is hidden from the caller.
- In general, these functions should only look at whatever special
- index the symbol reader creates -- looking through the symbol
- tables themselves is handled by generic code. If a function is
- defined as returning a "symbol table", this means that the function
- should only return a newly-created symbol table; it should not
- examine pre-existing ones.
-
The exact list of functions here was determined in an ad hoc way
based on gdb's history. */
/* Read all symbol tables associated with OBJFILE. */
virtual void expand_all_symtabs (struct objfile *objfile) = 0;
- /* Expand all symbol tables in OBJFILE matching some criteria.
+ /* Search all symbol tables in OBJFILE matching some criteria.
- If LANG_MATCHER returns false, expansion of the symbol table may be
- skipped. It may also not be skipped, which the caller needs to take into
- account.
+ If LANG_MATCHER returns false, search of the symbol table may be
+ skipped. It may also not be skipped, which the caller needs to
+ take into account.
FILE_MATCHER is called for each file in OBJFILE. The file name
is passed to it. If the matcher returns false, the file is
part).
If the file is not skipped, and SYMBOL_MATCHER and LOOKUP_NAME are NULL,
- the symbol table is expanded.
+ the symbol table is searched.
Otherwise, individual symbols are considered.
Note that if SYMBOL_MATCHER is non-NULL, then LOOKUP_NAME must
also be provided.
- Otherwise, the symbol's symbol table is expanded and EXPANSION_NOTIFY is
- called. If EXPANSION_NOTIFY returns false, execution stops and this method
- returns false. Otherwise, more files are considered. This method returns
- true if all calls to EXPANSION_NOTIFY return true. */
- virtual bool expand_symtabs_matching
+ Otherwise, the symbol's symbol table is expanded if needed.
+
+ Then (regardless of whether the symbol table was already
+ expanded, or just expanded in response to this search), LISTENER
+ is called. If LISTENER returns false, execution stops and this
+ method returns false. Otherwise, more files are considered.
+ This method returns true if all calls to LISTENER return
+ true. */
+ virtual bool search
(struct objfile *objfile,
- expand_symtabs_file_matcher file_matcher,
+ search_symtabs_file_matcher file_matcher,
const lookup_name_info *lookup_name,
- expand_symtabs_symbol_matcher symbol_matcher,
- expand_symtabs_expansion_listener expansion_notify,
+ search_symtabs_symbol_matcher symbol_matcher,
+ search_symtabs_expansion_listener listener,
block_search_flags search_flags,
domain_search_flags domain,
- expand_symtabs_lang_matcher lang_matcher = nullptr) = 0;
+ search_symtabs_lang_matcher lang_matcher = nullptr) = 0;
/* Return the comp unit from OBJFILE that contains PC and
SECTION. Return NULL if there is no such compunit. This
{
/* The callback to iterate_over_some_symtabs returns false to keep
going and true to continue, so we have to invert the result
- here, for expand_symtabs_matching. */
+ here, for search. */
bool result = !iterate_over_some_symtabs (name, real_path,
this->compunit_symtabs,
last_made,
for (const auto &iter : qf)
{
- if (!iter->expand_symtabs_matching (this,
- match_one_filename,
- nullptr,
- nullptr,
- on_expansion,
- (SEARCH_GLOBAL_BLOCK
- | SEARCH_STATIC_BLOCK),
- SEARCH_ALL_DOMAINS))
+ if (!iter->search (this, match_one_filename, nullptr, nullptr,
+ on_expansion,
+ SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
+ SEARCH_ALL_DOMAINS))
{
retval = false;
break;
for (const auto &iter : qf)
{
- if (!iter->expand_symtabs_matching (this,
- nullptr,
- &name,
- nullptr,
- search_one_symtab,
- kind == GLOBAL_BLOCK
- ? SEARCH_GLOBAL_BLOCK
- : SEARCH_STATIC_BLOCK,
- domain))
+ if (!iter->search (this, nullptr, &name, nullptr, search_one_symtab,
+ kind == GLOBAL_BLOCK
+ ? SEARCH_GLOBAL_BLOCK
+ : SEARCH_STATIC_BLOCK,
+ domain))
break;
}
};
for (const auto &iter : qf)
- iter->expand_symtabs_matching (this,
- file_matcher,
- nullptr,
- nullptr,
- nullptr,
- (SEARCH_GLOBAL_BLOCK
- | SEARCH_STATIC_BLOCK),
- SEARCH_ALL_DOMAINS);
+ iter->search (this, file_matcher, nullptr, nullptr, nullptr,
+ SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
+ SEARCH_ALL_DOMAINS);
}
bool
-objfile::expand_symtabs_matching
- (expand_symtabs_file_matcher file_matcher,
- const lookup_name_info *lookup_name,
- expand_symtabs_symbol_matcher symbol_matcher,
- expand_symtabs_expansion_listener expansion_notify,
- block_search_flags search_flags,
- domain_search_flags domain,
- expand_symtabs_lang_matcher lang_matcher)
-{
- /* This invariant is documented in quick-functions.h. */
+objfile::search (search_symtabs_file_matcher file_matcher,
+ const lookup_name_info *lookup_name,
+ search_symtabs_symbol_matcher symbol_matcher,
+ search_symtabs_expansion_listener listener,
+ block_search_flags search_flags,
+ domain_search_flags domain,
+ search_symtabs_lang_matcher lang_matcher)
+{
+ /* This invariant is documented in quick-symbol.h. */
gdb_assert (lookup_name != nullptr || symbol_matcher == nullptr);
if (debug_symfile)
gdb_printf (gdb_stdlog,
- "qf->expand_symtabs_matching (%s, %s, %s, %s, %s)\n",
+ "qf->search (%s, %s, %s, %s, %s)\n",
objfile_debug_name (this),
host_address_to_string (&file_matcher),
host_address_to_string (&symbol_matcher),
- host_address_to_string (&expansion_notify),
+ host_address_to_string (&listener),
domain_name (domain).c_str ());
for (const auto &iter : qf)
- if (!iter->expand_symtabs_matching (this, file_matcher, lookup_name,
- symbol_matcher, expansion_notify,
- search_flags, domain,
- lang_matcher))
+ if (!iter->search (this, file_matcher, lookup_name, symbol_matcher,
+ listener, search_flags, domain, lang_matcher))
return false;
return true;
}
for (struct program_space *pspace : program_spaces)
for (objfile *objfile : pspace->objfiles ())
- objfile->expand_symtabs_matching
+ objfile->search
([&] (const char *filename, bool basenames)
{
/* KISS: Only apply the regexp to the complete file name. */
return !accum.search (symtab, block, lookup_name, domain);
};
- objfile->expand_symtabs_matching (nullptr, &lookup_name, nullptr,
- searcher,
- block_index == GLOBAL_BLOCK
- ? SEARCH_GLOBAL_BLOCK
- : SEARCH_STATIC_BLOCK,
- domain);
+ objfile->search (nullptr, &lookup_name, nullptr, searcher,
+ block_index == GLOBAL_BLOCK
+ ? SEARCH_GLOBAL_BLOCK
+ : SEARCH_STATIC_BLOCK,
+ domain);
if (accum.best_symtab == nullptr)
{
symbol_lookup_debug_printf_v
{
return file_matches (filename, m_filenames, basenames);
};
- expand_symtabs_file_matcher file_matcher = nullptr;
+ search_symtabs_file_matcher file_matcher = nullptr;
if (!m_filenames.empty ())
file_matcher = do_file_match;
- objfile->expand_symtabs_matching
+ objfile->search
(file_matcher,
&lookup_name_info::match_any (),
[&] (const char *symname)
{
/* Look through the partial symtabs for all symbols which begin by
matching SYM_TEXT. Expand all CUs that you find to the list. */
- objfile->expand_symtabs_matching
+ objfile->search
(nullptr, &lookup_name, nullptr,
[&] (compunit_symtab *symtab)
{