summaryrefslogtreecommitdiff
path: root/gdb/psymtab.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2019-07-12 11:00:39 -0600
committerTom Tromey <tromey@adacore.com>2019-09-10 08:30:45 -0600
commit6a3dbf1bc620ae068c84074b2f72e11c24dc1e6d (patch)
treea1672a9db0aec737e60c18c9b80f363049504839 /gdb/psymtab.c
parent6969f124b987494df069b032e2e0f36485d3d8bb (diff)
downloadbinutils-gdb-6a3dbf1bc620ae068c84074b2f72e11c24dc1e6d.tar.gz
Simplify psym_map_matching_symbols
This introduces a new helper function, iterate_over_symbols_terminated, and changes psym_map_matching_symbols to use it. A subsequent patch will introduce a new user of this function in the DWARF reader. gdb/ChangeLog 2019-09-10 Tom Tromey <tromey@adacore.com> * psymtab.c (map_block): Remove. (psym_map_matching_symbols): Use iterate_over_symbols_terminated. * symtab.c (iterate_over_symbols_terminated): New function. * symtab.c (iterate_over_symbols_terminated): Declare.
Diffstat (limited to 'gdb/psymtab.c')
-rw-r--r--gdb/psymtab.c40
1 files changed, 4 insertions, 36 deletions
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index cd577bc4c53..81138bbe901 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1168,38 +1168,6 @@ psymtab_to_fullname (struct partial_symtab *ps)
return ps->fullname;
}
-/* For all symbols, s, in BLOCK that are in DOMAIN and match NAME
- according to the function MATCH, call CALLBACK(BLOCK, s, DATA).
- BLOCK is assumed to come from OBJFILE. Returns false iff CALLBACK
- ever returns false, and otherwise returns true. */
-
-static bool
-map_block (const char *name, domain_enum domain, struct objfile *objfile,
- const struct block *block,
- gdb::function_view<symbol_found_callback_ftype> callback,
- symbol_name_match_type match)
-{
- struct block_iterator iter;
- struct symbol *sym;
-
- lookup_name_info lookup_name (name, match);
-
- for (sym = block_iter_match_first (block, lookup_name, &iter);
- sym != NULL;
- sym = block_iter_match_next (lookup_name, &iter))
- {
- if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
- SYMBOL_DOMAIN (sym), domain))
- {
- struct block_symbol block_sym = {sym, block};
- if (!callback (&block_sym))
- return false;
- }
- }
-
- return true;
-}
-
/* Psymtab version of map_matching_symbols. See its definition in
the definition of quick_symbol_functions in symfile.h. */
@@ -1214,6 +1182,8 @@ psym_map_matching_symbols
{
const int block_kind = global ? GLOBAL_BLOCK : STATIC_BLOCK;
+ lookup_name_info lookup_name (name, match);
+
for (partial_symtab *ps : require_partial_symbols (objfile, 1))
{
QUIT;
@@ -1227,10 +1197,8 @@ psym_map_matching_symbols
if (cust == NULL)
continue;
block = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), block_kind);
- if (!map_block (name, domain, objfile, block, callback, match))
- return;
- struct block_symbol block_sym = {nullptr, block};
- if (!callback (&block_sym))
+ if (!iterate_over_symbols_terminated (block, lookup_name,
+ domain, callback))
return;
}
}