From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id kI+ROkPO7WdRjyQAWB0awg (envelope-from ) for ; Wed, 02 Apr 2025 19:54:43 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=T4DL0MWM; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id E62691E0C3; Wed, 2 Apr 2025 19:54:43 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 897481E0C0 for ; Wed, 2 Apr 2025 19:54:43 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 36A69385B51B for ; Wed, 2 Apr 2025 23:54:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 36A69385B51B Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=T4DL0MWM Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) by sourceware.org (Postfix) with ESMTPS id 7DD96385B529 for ; Wed, 2 Apr 2025 23:45:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7DD96385B529 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 7DD96385B529 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1743637521; cv=none; b=B2l1F9xYKAIej8jfRdSCjOwXcvC1fDvEf1Jw1gCVJv/ONNej7EPcIcvazhMd5qm/v+nHyFVYJgpvFg8eosV6T31bnuXLVjd8x5A8U4SkZOJ/wnqvPyO8vP2fLIqZwJGl44+GmOvSHE+jHcOiLKqPe+2QidMX1AfgjW5FjO9BLQU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1743637521; c=relaxed/simple; bh=OgTuyS5j7p1CCaoY2YNBL20Jj/awNskcrok+X4Ip1Zw=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=ZCac71nyxGxZcdxBjpekA9iiZeUzJ8DgUgxK3qlutVd+fZKjfin/rV+h9s4VSijJBFn+O3Jb6PGY5fyXng7vtyiPMWWnQiDU28jNbOCZXUoNH/jJKkJcVcTiJdRpHjED52CeuNKOiYCoRFKSGf8tXRA7GCCFSSyO2FbEslHtYEo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7DD96385B529 Received: from eig-obgw-6009a.ext.cloudfilter.net ([10.0.30.184]) by cmsmtp with ESMTPS id 070GudfQRf1UX07louFImV; Wed, 02 Apr 2025 23:45:20 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id 07louJctA1ywG07louRVpA; Wed, 02 Apr 2025 23:45:20 +0000 X-Authority-Analysis: v=2.4 cv=bqlKBlai c=1 sm=1 tr=0 ts=67edcc10 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=ItBw4LHWJt0A:10 a=sVY4BuJTz4wnXaYb6gsA:9 a=QEXdDO2ut3YA:10 a=6Ogn3jAGHLSNbaov7Orx:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To: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=f/h0LK+fmF5kJwYWGfQg8KbSNxrmnVTDDLd2h0nhPvA=; b=T4DL0MWMmXP1HCje8luGK2G48E wL/Lr8VlG9R9mtwNsdjMntqrXqOnWz2yuU2H4mKeTR1LP8FDjG6tqBp9FwPJYGC4BZl4iDU4igusk PDjU/DC4kFxyp0VOOI3VplIcp; Received: from 97-122-123-18.hlrn.qwest.net ([97.122.123.18]:56394 helo=prentzel.local) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.1) (envelope-from ) id 1u07ln-000000014hd-3Tjr; Wed, 02 Apr 2025 17:45:19 -0600 From: Tom Tromey Date: Wed, 02 Apr 2025 17:45:22 -0600 Subject: [PATCH v2 23/28] Simplify block_lookup_symbol MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20250402-search-in-psyms-v2-23-ea91704487cb@tromey.com> References: <20250402-search-in-psyms-v2-0-ea91704487cb@tromey.com> In-Reply-To: <20250402-search-in-psyms-v2-0-ea91704487cb@tromey.com> To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.14.2 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.123.18 X-Source-L: No X-Exim-ID: 1u07ln-000000014hd-3Tjr X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-123-18.hlrn.qwest.net (prentzel.local) [97.122.123.18]:56394 X-Source-Auth: tom+tromey.com X-Email-Count: 24 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfBTNCuB3mS+nhcfHSUlI0jDQvBEoZpPSx0oc7gQx4uqtfQX0m2J38twypCKpUTK26bEqYLw6N/TRD8ZClRklw9zqY2orfXwxtrLsSATDZvnoX1L0yWUD UZKN9QsHOumqukxue5XI+141VvJdw6k6IhrwbhHo+NNEU6Id2ke7MEwT+EuGl8yV5NFsQRtK8j0U+ZH8NymcaGW/edjsIJp20Bw= 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~public-inbox=simark.ca@sourceware.org One loop in block_lookup_symbol is identical to the code in block_lookup_symbol_primary. This patch simplifies the former by having it call the latter. This removes an assert. However, note that the assert is not needed -- it does not check any invariant that must be maintained. --- gdb/block.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/gdb/block.c b/gdb/block.c index 583c4ef1bf07ab942af71d0f1d1b38799849451d..d8f8bf56de7b1498ae3f89650a3c86c4eafe3bfe 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -669,24 +669,7 @@ block_lookup_symbol (const struct block *block, const lookup_name_info &name, const domain_search_flags domain) { if (!block->function ()) - { - struct symbol *other = NULL; - - for (struct symbol *sym : block_iterator_range (block, &name)) - { - /* See comment related to PR gcc/debug/91507 in - block_lookup_symbol_primary. */ - if (best_symbol (sym, domain)) - return sym; - /* This is a bit of a hack, but symbol_matches_domain might ignore - STRUCT vs VAR domain symbols. So if a matching symbol is found, - make sure there is no "better" matching symbol, i.e., one with - exactly the same domain. PR 16253. */ - if (sym->matches (domain)) - other = better_symbol (other, sym, domain); - } - return other; - } + return block_lookup_symbol_primary (block, name, domain); else { /* Note that parameter symbols do not always show up last in the @@ -722,10 +705,6 @@ block_lookup_symbol_primary (const struct block *block, const lookup_name_info &name, const domain_search_flags domain) { - /* Verify BLOCK is STATIC_BLOCK or GLOBAL_BLOCK. */ - gdb_assert (block->superblock () == NULL - || block->superblock ()->superblock () == NULL); - symbol *other = nullptr; for (symbol *sym : block_iterator_range (block, &name)) { -- 2.46.1