From patchwork Tue Nov 21 03:53:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 80415 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A34203858CDA for ; Tue, 21 Nov 2023 03:56:01 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta34.uswest2.a.cloudfilter.net (omta34.uswest2.a.cloudfilter.net [35.89.44.33]) by sourceware.org (Postfix) with ESMTPS id 13C653858413 for ; Tue, 21 Nov 2023 03:53:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 13C653858413 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 13C653858413 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700538811; cv=none; b=xltQ7P4waxeMCF0qMABhFST7E7QduHPDqFoL0vtH2Jv8KOfZgpogWN3TRjfDPNEG/XjSEu7DDvgyOquRSXthleP81l7gNDgHqCnJdBkynb6AugOd17fSMvgDbl+jJnoQCWyWoA1mkSsfk8cuEkC7+lgF9tqaarEcgiYUpPsTct4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700538811; c=relaxed/simple; bh=NyEb5sGbt8fbxetbCIhwUrR9gUcth7t/hzjGevji7zA=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=lF+eUh2R0LU74bAv4Gxgzp8c651q6qUbLGbtmjqWIwb4LOjWfdF/81tJEYo1FeqUK4GKRenTa/LQ4WBi123AzZTpHtjYTFX1Yz1KBPj4GBrQkZDb3XoVX8UAzPvNt2GL+uk6X1GBJJFgpg3Q1M7FINQE2Sq10RxgjRH5v/uBtls= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6010a.ext.cloudfilter.net ([10.0.30.248]) by cmsmtp with ESMTPS id 5BwbrSPny8Hte5HpDrHZXG; Tue, 21 Nov 2023 03:53:23 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id 5HpCrSMLu8vT05HpDrMCz4; Tue, 21 Nov 2023 03:53:23 +0000 X-Authority-Analysis: v=2.4 cv=ffi+dmcF c=1 sm=1 tr=0 ts=655c29b3 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA:10 a=Qbun_eYptAEA:10 a=ABg-ZwUhIPAXn4CSIH0A:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=5hOQpaDgqe9jfKHHvCJV/c9xX8I53n7mWxggWiFxKe8=; b=nR5+OdmYcuBZ5jZ6y5JjA5txN6 7UNqNDA+eB/Tqllnf9Pkv6dQ/xfTJTrPqZ79Fjuzksv00QPnGPq0QkL9VcehDJ27YFDMrEHO1vjvL 42OGJvjoisPYArtznunjFG6gK; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:47856 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1r5HpC-0040be-1e for gdb-patches@sourceware.org; Mon, 20 Nov 2023 20:53:22 -0700 From: Tom Tromey Date: Mon, 20 Nov 2023 20:53:59 -0700 Subject: [PATCH 28/29] Refine search in cp_search_static_and_baseclasses MIME-Version: 1.0 Message-Id: <20231120-submit-domain-hacks-2-v1-28-29650d01b198@tromey.com> References: <20231120-submit-domain-hacks-2-v1-0-29650d01b198@tromey.com> In-Reply-To: <20231120-submit-domain-hacks-2-v1-0-29650d01b198@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.77.73 X-Source-L: No X-Exim-ID: 1r5HpC-0040be-1e X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:47856 X-Source-Auth: tom+tromey.com X-Email-Count: 29 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfDEam2odwz2aB5MVcQounTAIB4pOpTYGYPaElVK9ZBe6WetUnk58hj9/I3TmpOsyP/LHyq4tg+iE03f85oZnWF10553mIlprQ9FUXZvQNZZ9QC13ERrY FUy53hw2QTXIE8/fWyhmKN4Qyw/9J7hODoe3J1qM/Ee4DSvR48R0NAe/pVr8hWL56u6WEkfFSqCqzERJNa0EMZUPyy6BncCoFE4= X-Spam-Status: No, score=-3024.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, 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.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org This changes cp_search_static_and_baseclasses to only search for types, functions, and modules. The latter two cases were discovered by regression testing. I found it somewhat surprising the Fortran name lookup ends up in this code, but did not attempt to change this. --- gdb/cp-namespace.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index 7c1e9576800..933d2b10cd5 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -268,14 +268,19 @@ cp_search_static_and_baseclasses (const char *name, const char *nested = name + prefix_len + 2; /* Lookup the scope symbol. If none is found, there is nothing more - that can be done. SCOPE could be a namespace, so always look in - VAR_DOMAIN. This works for classes too because of - symbol_matches_domain (which should be replaced with something - else, but it's what we have today). */ - block_symbol scope_sym = lookup_symbol_in_static_block (scope.c_str (), - block, SEARCH_VFT); + that can be done. SCOPE could be a namespace, a class, or even a + function. This code is also used by Fortran, so modules are + included in the search as well. */ + block_symbol scope_sym + = lookup_symbol_in_static_block (scope.c_str (), block, + SEARCH_TYPE_DOMAIN + | SEARCH_FUNCTION_DOMAIN + | SEARCH_MODULE_DOMAIN); if (scope_sym.symbol == NULL) - scope_sym = lookup_global_symbol (scope.c_str (), block, SEARCH_VFT); + scope_sym = lookup_global_symbol (scope.c_str (), block, + SEARCH_TYPE_DOMAIN + | SEARCH_FUNCTION_DOMAIN + | SEARCH_MODULE_DOMAIN); if (scope_sym.symbol == NULL) return {};