From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by sourceware.org (Postfix) with ESMTPS id 8D598396E029 for ; Thu, 2 Jun 2022 14:29:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8D598396E029 X-IronPort-AV: E=McAfee;i="6400,9594,10365"; a="273531668" X-IronPort-AV: E=Sophos;i="5.91,271,1647327600"; d="scan'208";a="273531668" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2022 07:29:16 -0700 X-IronPort-AV: E=Sophos;i="5.91,271,1647327600"; d="scan'208";a="667998666" Received: from labpc2407.iul.intel.com (HELO localhost) ([172.28.50.61]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2022 07:29:15 -0700 From: Markus Metzger To: gdb-patches@sourceware.org Subject: [PATCH v5 11/15] gdb, cp: update add_symbol_overload_list_qualified Date: Thu, 2 Jun 2022 15:25:10 +0200 Message-Id: <20220602132514.957983-12-markus.t.metzger@intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220602132514.957983-1-markus.t.metzger@intel.com> References: <20220602132514.957983-1-markus.t.metzger@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2022 14:29:19 -0000 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. --- 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 807c944a97c..d76ec433772 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. */ -- 2.35.3 Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928