From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1805) id 8185D3858C83; Tue, 18 Oct 2022 13:25:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8185D3858C83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666099533; bh=vsqpoJ2l0XA2Xl9gtrT93jwEbvJipfGmumBTbiaHLW0=; h=From:To:Subject:Date:From; b=YjN7kJhF2LYaaClADoTErzm13mvLIWHQiZD0XmxXqLyWFSMevHCuGpF1SK8ChyxmG WMHROuZa/iLnwUhfniMr+OjxSiieHFuT2ML5CEPuJW1JDCVg/lf5KphDaG3tYsUEHZ lzWopJfReSNvxJGo3K8/wyylL5tXRJljg2s+4ObU= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Markus Metzger To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb, cp: update add_symbol_overload_list_qualified X-Act-Checkin: binutils-gdb X-Git-Author: Markus Metzger X-Git-Refname: refs/heads/master X-Git-Oldrev: 5f0277edf24612029c5ff513342adcb01db56e7a X-Git-Newrev: 2aab2438702dfb22d6fa0c5d8bef267f3d24638b Message-Id: <20221018132533.8185D3858C83@sourceware.org> Date: Tue, 18 Oct 2022 13:25:33 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D2aab2438702d= fb22d6fa0c5d8bef267f3d24638b commit 2aab2438702dfb22d6fa0c5d8bef267f3d24638b Author: Markus Metzger Date: Tue Apr 26 15:11:09 2022 +0200 gdb, cp: update add_symbol_overload_list_qualified =20 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 *fun= c_name, /* Go through the symtabs and check the externs and statics for symbols which match. */ =20 - for (objfile *objfile : current_program_space->objfiles ()) - { - for (compunit_symtab *cust : objfile->compunits ()) - { - QUIT; - const block *b =3D 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 =3D cust->blockvector ()->static_block (); - - /* Don't do this block twice. */ - if (b =3D=3D surrounding_static_block) - continue; - - add_symbol_overload_list_block (func_name, b, overload_list); - } - } + const block *block =3D get_selected_block (0); + struct objfile *current_objfile =3D block ? block_objfile (block) : null= ptr; + + 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 =3D cust->blockvector ()->global_block (); + add_symbol_overload_list_block (func_name, b, overload_list); + + b =3D cust->blockvector ()->static_block (); + /* Don't do this block twice. */ + if (b =3D=3D surrounding_static_block) + continue; + + add_symbol_overload_list_block (func_name, b, overload_list); + } + + return 0; + }, current_objfile); } =20 /* Lookup the rtti type for a class name. */