public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Markus Metzger <mmetzger@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb, cp: update add_symbol_overload_list_qualified Date: Tue, 18 Oct 2022 13:25:33 +0000 (GMT) [thread overview] Message-ID: <20221018132533.8185D3858C83@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2aab2438702dfb22d6fa0c5d8bef267f3d24638b commit 2aab2438702dfb22d6fa0c5d8bef267f3d24638b Author: Markus Metzger <markus.t.metzger@intel.com> Date: Tue Apr 26 15:11:09 2022 +0200 gdb, cp: update add_symbol_overload_list_qualified Iterate over objfiles in search order using the objfile of the selected block as current_objfile so the iteration can stay inside the block's linker namespace. Diff: --- gdb/cp-support.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/gdb/cp-support.c b/gdb/cp-support.c index 1891bac4f9b..77895a8bc98 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -1460,30 +1460,30 @@ add_symbol_overload_list_qualified (const char *func_name, /* Go through the symtabs and check the externs and statics for symbols which match. */ - for (objfile *objfile : current_program_space->objfiles ()) - { - for (compunit_symtab *cust : objfile->compunits ()) - { - QUIT; - const block *b = cust->blockvector ()->global_block (); - add_symbol_overload_list_block (func_name, b, overload_list); - } - } - - for (objfile *objfile : current_program_space->objfiles ()) - { - for (compunit_symtab *cust : objfile->compunits ()) - { - QUIT; - const block *b = cust->blockvector ()->static_block (); - - /* Don't do this block twice. */ - if (b == surrounding_static_block) - continue; - - add_symbol_overload_list_block (func_name, b, overload_list); - } - } + const block *block = get_selected_block (0); + struct objfile *current_objfile = block ? block_objfile (block) : nullptr; + + gdbarch_iterate_over_objfiles_in_search_order + (current_objfile ? current_objfile->arch () : target_gdbarch (), + [func_name, surrounding_static_block, &overload_list] + (struct objfile *obj) + { + for (compunit_symtab *cust : obj->compunits ()) + { + QUIT; + const struct block *b = cust->blockvector ()->global_block (); + add_symbol_overload_list_block (func_name, b, overload_list); + + b = cust->blockvector ()->static_block (); + /* Don't do this block twice. */ + if (b == surrounding_static_block) + continue; + + add_symbol_overload_list_block (func_name, b, overload_list); + } + + return 0; + }, current_objfile); } /* Lookup the rtti type for a class name. */
reply other threads:[~2022-10-18 13:25 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20221018132533.8185D3858C83@sourceware.org \ --to=mmetzger@sourceware.org \ --cc=gdb-cvs@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).