aboutsummaryrefslogtreecommitdiff
path: root/gdb/symtab.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/symtab.c
parent6969f124b987494df069b032e2e0f36485d3d8bb (diff)
downloadbinutils-6a3dbf1bc620ae068c84074b2f72e11c24dc1e6d.zip
binutils-6a3dbf1bc620ae068c84074b2f72e11c24dc1e6d.tar.gz
binutils-6a3dbf1bc620ae068c84074b2f72e11c24dc1e6d.tar.bz2
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/symtab.c')
-rw-r--r--gdb/symtab.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 5f18445..e1bf369 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2847,6 +2847,21 @@ iterate_over_symbols (const struct block *block,
return true;
}
+/* See symtab.h. */
+
+bool
+iterate_over_symbols_terminated
+ (const struct block *block,
+ const lookup_name_info &name,
+ const domain_enum domain,
+ gdb::function_view<symbol_found_callback_ftype> callback)
+{
+ if (!iterate_over_symbols (block, name, domain, callback))
+ return false;
+ struct block_symbol block_sym = {nullptr, block};
+ return callback (&block_sym);
+}
+
/* Find the compunit symtab associated with PC and SECTION.
This will read in debug info as necessary. */