mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 09:08:59 +00:00
Rename expand_symtabs_matching
After this series, expand_symtabs_matching is now misnamed. This patch renames it, renames some associated types, and also fixes up some comments that I previously missed. Acked-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
@@ -5519,12 +5519,9 @@ map_matching_symbols (struct objfile *objfile,
|
||||
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
|
||||
@@ -13132,7 +13129,7 @@ ada_add_global_exceptions (compiled_regex *preg,
|
||||
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)
|
||||
@@ -13752,7 +13749,7 @@ public:
|
||||
return true;
|
||||
};
|
||||
|
||||
objfile->expand_symtabs_matching
|
||||
objfile->search
|
||||
(nullptr, &lookup_name, nullptr, callback,
|
||||
SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
|
||||
SEARCH_ALL_DOMAINS);
|
||||
|
||||
@@ -1496,11 +1496,9 @@ add_symbol_overload_list_qualified (const char *func_name,
|
||||
/* 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);
|
||||
|
||||
@@ -237,15 +237,15 @@ struct cooked_index_functions : public dwarf2_base_index_functions
|
||||
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,
|
||||
|
||||
@@ -851,10 +851,10 @@ static struct dwarf2_section_info *cu_debug_loc_section (struct dwarf2_cu *cu);
|
||||
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 *,
|
||||
@@ -1530,20 +1530,18 @@ struct readnow_functions : public dwarf2_base_index_functions
|
||||
{
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -1559,10 +1557,8 @@ struct readnow_functions : public dwarf2_base_index_functions
|
||||
|| 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;
|
||||
@@ -2001,13 +1997,13 @@ dwarf2_base_index_functions::expand_all_symtabs (struct objfile *objfile)
|
||||
/* 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))
|
||||
@@ -2026,10 +2022,10 @@ dw2_expand_symtabs_matching_one
|
||||
= 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;
|
||||
@@ -2039,10 +2035,10 @@ dw2_expand_symtabs_matching_one
|
||||
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;
|
||||
@@ -14597,23 +14593,22 @@ cooked_index_functions::find_compunit_symtab_by_address
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -14623,10 +14618,8 @@ cooked_index_functions::expand_symtabs_matching
|
||||
{
|
||||
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;
|
||||
@@ -14794,9 +14787,8 @@ cooked_index_functions::expand_symtabs_matching
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1247,15 +1247,15 @@ private:
|
||||
};
|
||||
|
||||
/* 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. */
|
||||
|
||||
|
||||
@@ -1170,11 +1170,8 @@ iterate_over_all_matching_symtabs
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3770,7 +3767,7 @@ find_linespec_symbols (struct linespec_state *state,
|
||||
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
|
||||
|
||||
@@ -596,14 +596,14 @@ public:
|
||||
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 *
|
||||
|
||||
@@ -790,7 +790,7 @@ psymtab_to_fullname (struct partial_symtab *ps)
|
||||
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. */
|
||||
@@ -800,7 +800,7 @@ recursively_search_psymtabs (partial_symtab *ps, objfile *objfile,
|
||||
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;
|
||||
@@ -885,19 +885,19 @@ recursively_search_psymtabs (partial_symtab *ps, objfile *objfile,
|
||||
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))
|
||||
@@ -941,8 +941,8 @@ psymbol_functions::expand_symtabs_matching
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -626,15 +626,15 @@ struct psymbol_functions : public quick_symbol_functions
|
||||
|
||||
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,
|
||||
|
||||
@@ -632,9 +632,8 @@ gdbpy_lookup_static_symbols (PyObject *self, PyObject *args, PyObject *kw)
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,30 +37,29 @@ DEF_ENUM_FLAGS_TYPE (enum block_search_flag_values, block_search_flags);
|
||||
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
|
||||
@@ -71,13 +70,6 @@ using expand_symtabs_expansion_listener
|
||||
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. */
|
||||
|
||||
@@ -130,11 +122,11 @@ struct quick_symbol_functions
|
||||
/* 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
|
||||
@@ -144,7 +136,7 @@ struct quick_symbol_functions
|
||||
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.
|
||||
|
||||
@@ -156,19 +148,23 @@ struct quick_symbol_functions
|
||||
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
|
||||
|
||||
@@ -193,7 +193,7 @@ objfile::map_symtabs_matching_filename
|
||||
{
|
||||
/* 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,
|
||||
@@ -204,14 +204,10 @@ objfile::map_symtabs_matching_filename
|
||||
|
||||
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;
|
||||
@@ -267,15 +263,11 @@ objfile::lookup_symbol (block_enum kind, const lookup_name_info &name,
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -336,43 +328,35 @@ objfile::expand_symtabs_with_fullname (const char *fullname)
|
||||
};
|
||||
|
||||
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)
|
||||
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-functions.h. */
|
||||
/* 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;
|
||||
}
|
||||
|
||||
@@ -918,7 +918,7 @@ maintenance_expand_symtabs (const char *args, int from_tty)
|
||||
|
||||
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. */
|
||||
|
||||
17
gdb/symtab.c
17
gdb/symtab.c
@@ -2427,12 +2427,11 @@ lookup_symbol_via_quick_fns (struct objfile *objfile,
|
||||
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
|
||||
@@ -4780,11 +4779,11 @@ global_symbol_searcher::expand_symtabs
|
||||
{
|
||||
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)
|
||||
@@ -6002,7 +6001,7 @@ default_collect_symbol_completion_matches_break_on
|
||||
{
|
||||
/* 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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user