From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by sourceware.org (Postfix) with ESMTPS id 47017396E071 for ; Thu, 2 Jun 2022 14:29:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 47017396E071 X-IronPort-AV: E=McAfee;i="6400,9594,10365"; a="362337283" X-IronPort-AV: E=Sophos;i="5.91,271,1647327600"; d="scan'208";a="362337283" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2022 07:29:08 -0700 X-IronPort-AV: E=Sophos;i="5.91,271,1647327600"; d="scan'208";a="824279344" Received: from labpc2407.iul.intel.com (HELO localhost) ([172.28.50.61]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2022 07:29:07 -0700 From: Markus Metzger To: gdb-patches@sourceware.org Subject: [PATCH v5 08/15] gdb, ada: collect standard exceptions in all objfiles Date: Thu, 2 Jun 2022 15:25:07 +0200 Message-Id: <20220602132514.957983-9-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.8 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:15 -0000 When searching for standard exceptions for Ada, we lookup the minimal symbol of each exception. With linker namespaces there can be multiple instances in different namespaces. Collect them all. --- gdb/ada-lang.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 6ab01fd27d4..2b251693b72 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13016,15 +13016,29 @@ ada_add_standard_exceptions (compiled_regex *preg, { if (preg == NULL || preg->exec (name, 0, NULL, 0) == 0) { - struct bound_minimal_symbol msymbol - = ada_lookup_simple_minsym (name); + symbol_name_match_type match_type = name_match_type_from_name (name); + lookup_name_info lookup_name (name, match_type); - if (msymbol.minsym != NULL) - { - struct ada_exc_info info - = {name, msymbol.value_address ()}; + symbol_name_matcher_ftype *match_name + = ada_get_symbol_name_matcher (lookup_name); - exceptions->push_back (info); + /* Iterate over all objfiles irrespective of scope or linker + namespaces so we get all exceptions anywhere in the + progspace. */ + for (objfile *objfile : current_program_space->objfiles ()) + { + for (minimal_symbol *msymbol : objfile->msymbols ()) + { + if (match_name (msymbol->linkage_name (), lookup_name, + nullptr) + && msymbol->type () != mst_solib_trampoline) + { + ada_exc_info info + = {name, msymbol->value_address (objfile)}; + + exceptions->push_back (info); + } + } } } } @@ -13122,6 +13136,8 @@ ada_add_global_exceptions (compiled_regex *preg, SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK, VARIABLES_DOMAIN); + /* Iterate over all objfiles irrespective of scope or linker namespaces + so we get all exceptions anywhere in the progspace. */ for (objfile *objfile : current_program_space->objfiles ()) { for (compunit_symtab *s : objfile->compunits ()) -- 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