diff options
author | Tom Tromey <tromey@adacore.com> | 2019-07-12 10:45:34 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2019-09-10 08:30:45 -0600 |
commit | 199b4314efbd419d6957e366e13a14cd87cea5e4 (patch) | |
tree | f1844b4639994e943190a9e15a9940c8bd7318e4 /gdb/psymtab.c | |
parent | Enhance the disassembler so that it will reliably determine whether a reloc a... (diff) | |
download | binutils-gdb-199b4314efbd419d6957e366e13a14cd87cea5e4.tar.gz binutils-gdb-199b4314efbd419d6957e366e13a14cd87cea5e4.tar.bz2 binutils-gdb-199b4314efbd419d6957e366e13a14cd87cea5e4.zip |
Change map_matching_symbols to take a symbol_found_callback_ftype
This changes map_matching_symbols to take a
symbol_found_callback_ftype, rather than separate callback and data
parameters. This enables a future patch to clean up some existing
code so that it can more readily be shared.
gdb/ChangeLog
2019-09-10 Tom Tromey <tromey@adacore.com>
* ada-lang.c (aux_add_nonlocal_symbols): Change type.
(add_nonlocal_symbols): Update.
* dwarf2read.c (dw2_map_matching_symbols): Change type.
* psymtab.c (map_block, psym_map_matching_symbols): Change type.
* symfile-debug.c (debug_qf_map_matching_symbols): Change type.
* symfile.h (struct quick_symbol_functions) <map_matching_symbols>:
Change type of "callback". Remove "data".
Diffstat (limited to 'gdb/psymtab.c')
-rw-r--r-- | gdb/psymtab.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 70d04f86052..cd577bc4c53 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1170,14 +1170,14 @@ psymtab_to_fullname (struct partial_symtab *ps) /* 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 1 iff CALLBACK - ever returns non-zero, and otherwise returns 0. */ + BLOCK is assumed to come from OBJFILE. Returns false iff CALLBACK + ever returns false, and otherwise returns true. */ -static int +static bool map_block (const char *name, domain_enum domain, struct objfile *objfile, const struct block *block, - int (*callback) (const struct block *, struct symbol *, void *), - void *data, symbol_name_match_type match) + gdb::function_view<symbol_found_callback_ftype> callback, + symbol_name_match_type match) { struct block_iterator iter; struct symbol *sym; @@ -1191,26 +1191,26 @@ map_block (const char *name, domain_enum domain, struct objfile *objfile, if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), SYMBOL_DOMAIN (sym), domain)) { - if (callback (block, sym, data)) - return 1; + struct block_symbol block_sym = {sym, block}; + if (!callback (&block_sym)) + return false; } } - return 0; + return true; } /* Psymtab version of map_matching_symbols. See its definition in the definition of quick_symbol_functions in symfile.h. */ static void -psym_map_matching_symbols (struct objfile *objfile, - const char *name, domain_enum domain, - int global, - int (*callback) (const struct block *, - struct symbol *, void *), - void *data, - symbol_name_match_type match, - symbol_compare_ftype *ordered_compare) +psym_map_matching_symbols + (struct objfile *objfile, + const char *name, domain_enum domain, + int global, + gdb::function_view<symbol_found_callback_ftype> callback, + symbol_name_match_type match, + symbol_compare_ftype *ordered_compare) { const int block_kind = global ? GLOBAL_BLOCK : STATIC_BLOCK; @@ -1227,10 +1227,10 @@ psym_map_matching_symbols (struct objfile *objfile, if (cust == NULL) continue; block = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), block_kind); - if (map_block (name, domain, objfile, block, - callback, data, match)) + if (!map_block (name, domain, objfile, block, callback, match)) return; - if (callback (block, NULL, data)) + struct block_symbol block_sym = {nullptr, block}; + if (!callback (&block_sym)) return; } } |