public inbox for gdb-testers@sourceware.org help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net To: gdb-testers@sourceware.org Subject: [binutils-gdb] Simplify psym_map_matching_symbols Date: Tue, 10 Sep 2019 15:52:00 -0000 [thread overview] Message-ID: <6a3dbf1bc620ae068c84074b2f72e11c24dc1e6d@gdb-build> (raw) *** TEST RESULTS FOR COMMIT 6a3dbf1bc620ae068c84074b2f72e11c24dc1e6d *** commit 6a3dbf1bc620ae068c84074b2f72e11c24dc1e6d Author: Tom Tromey <tromey@adacore.com> AuthorDate: Fri Jul 12 11:00:39 2019 -0600 Commit: Tom Tromey <tromey@adacore.com> CommitDate: Tue Sep 10 08:30:45 2019 -0600 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. diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e2ebafe714..129aaad7d2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +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. + 2019-09-10 Tom Tromey <tromey@adacore.com> * ada-lang.c (ada_iterate_over_symbols): Return bool. diff --git a/gdb/psymtab.c b/gdb/psymtab.c index cd577bc4c5..81138bbe90 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; } } diff --git a/gdb/symtab.c b/gdb/symtab.c index 5f184454bd..e1bf3692a5 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. */ diff --git a/gdb/symtab.h b/gdb/symtab.h index 49feea62e2..4fb00cba9f 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -2106,6 +2106,16 @@ bool iterate_over_symbols (const struct block *block, const domain_enum domain, gdb::function_view<symbol_found_callback_ftype> callback); +/* Like iterate_over_symbols, but if all calls to CALLBACK return + true, then calls CALLBACK one additional time with a block_symbol + that has a valid block but a NULL symbol. */ + +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); + /* Storage type used by demangle_for_lookup. demangle_for_lookup either returns a const char * pointer that points to either of the fields of this type, or a pointer to the input NAME. This is done
next reply other threads:[~2019-09-10 15:39 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-09-10 15:52 gdb-buildbot [this message] 2019-09-10 15:52 ` Failures on RHEL-s390x-m64, branch master gdb-buildbot 2019-09-10 16:40 ` Failures on Ubuntu-Aarch64-m64, " gdb-buildbot 2019-09-10 16:53 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, " gdb-buildbot 2019-09-10 17:30 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot 2019-09-10 18:32 ` Failures on Debian-s390x-m64, " gdb-buildbot 2019-09-10 18:46 ` Failures on Debian-s390x-native-extended-gdbserver-m64, " gdb-buildbot 2019-09-10 18:55 ` Failures on Debian-s390x-native-gdbserver-m64, " gdb-buildbot 2019-09-10 19:25 ` Failures on Fedora-i686, " gdb-buildbot 2019-09-10 19:35 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot 2019-09-10 19:41 ` Failures on Fedora-x86_64-m64, " gdb-buildbot 2019-09-10 20:01 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot 2019-09-10 20:08 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot 2019-09-10 20:28 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=6a3dbf1bc620ae068c84074b2f72e11c24dc1e6d@gdb-build \ --to=gdb-buildbot@sergiodj.net \ --cc=gdb-testers@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).