From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id BpP6BZ7Q7WcdkiQAWB0awg (envelope-from ) for ; Wed, 02 Apr 2025 20:04:46 -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=sgAZL9kG; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 066FD1E100; Wed, 2 Apr 2025 20:04:46 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,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 6818E1E0C0 for ; Wed, 2 Apr 2025 20:04:45 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0A857385AC35 for ; Thu, 3 Apr 2025 00:04:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0A857385AC35 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=sgAZL9kG Received: from omta34.uswest2.a.cloudfilter.net (omta34.uswest2.a.cloudfilter.net [35.89.44.33]) by sourceware.org (Postfix) with ESMTPS id 29A10385AC21 for ; Wed, 2 Apr 2025 23:45:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 29A10385AC21 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 29A10385AC21 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=1743637521; cv=none; b=v9Y9blRRiRf+Zbe2GMEH/5AnAQUks2Zd5YYNnj77sw3Vcte7M9Qry7QHJQX/vn2ynDU5T9qFv6v1HCOq2SuDONZ9LbG5Z6wbgCmRR++sw6UWYPUvcpF6l34JpU0oy4WlJX8S/NQc4O7UCRnB2+VOLPAFRSXjBB4JQ547DMndrwo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1743637521; c=relaxed/simple; bh=9Jd/PqoFdlx4+wN2snOwcoaEWMjIrzfL8sHI7GPodAk=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=xdSRAPsq8WkBDoyfZZMcz71lYWlGv9thCt4kJ4bgQD4syltDbrdgYqTOz7piKGKXdgi7hsVhr3Yh0poWeIMpNZJRHu/AfGRw6425CY9OgYHmCRwHA2oUXQIQHF5G6l/F8xoial8fhNMDYhpns/xU32U9ydtBtjcl3xSNY8EzWMM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 29A10385AC21 Received: from eig-obgw-5003a.ext.cloudfilter.net ([10.0.29.159]) by cmsmtp with ESMTPS id zxsytHv5GWuHK07louzjzc; Wed, 02 Apr 2025 23:45:21 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id 07lnuSr29liBX07loup7Or; Wed, 02 Apr 2025 23:45:20 +0000 X-Authority-Analysis: v=2.4 cv=bOXdI++Z c=1 sm=1 tr=0 ts=67edcc10 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=ItBw4LHWJt0A:10 a=hJUq39NCGxIoF6gC9L4A: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=7dsC2KX2i675q08w3Smk+UkEdHX5H03Wp6WAo/0RULw=; b=sgAZL9kG4x4pvyl6UZ81pHzgra UKPN+tIMhEFCUcojcFytJwlgKHTRqeXSNLEbL9uj9F5rJJ1JnHJKeR/QCwztPgrnko1M0RaSXMX2y GA53LwIvMp5+K/ENve0myoVvU; 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-29v8; Wed, 02 Apr 2025 17:45:19 -0600 From: Tom Tromey Date: Wed, 02 Apr 2025 17:45:21 -0600 Subject: [PATCH v2 22/28] Pass lookup_name_info to block_lookup_symbol_primary MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20250402-search-in-psyms-v2-22-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-29v8 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: 23 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfH+man4QGIZchfUD/G/1ZdlK11PHNTf2cMf9jvhUjMyBRmESooWtg1b7FFxtMWql6pYFRvdbVemQ4oooTwdM+qiedqvgwnS2AmVhOEjPyDTR1ZzdPOB2 ikjEXk1ruMWOo/sHYBpN4RhEMdqchb55DRkj7l4jlyuSoSZ7M8pqmMJDXCACxewcmSk1q4e1Pg7iqRaia1JRid4yhrOnrU+VCk4= 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 This changes block_lookup_symbol_primary to accept a lookup_name_info. This follows the general trend of hoisting these objects to the outermost layer where they make sense -- somewhat reducing the cost of using them. --- gdb/block.c | 7 +++---- gdb/block.h | 2 +- gdb/symtab.c | 3 ++- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gdb/block.c b/gdb/block.c index 2c07b38f8f806b8a154eb42adbd3f53a3535c57f..583c4ef1bf07ab942af71d0f1d1b38799849451d 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -718,17 +718,16 @@ block_lookup_symbol (const struct block *block, const lookup_name_info &name, /* See block.h. */ struct symbol * -block_lookup_symbol_primary (const struct block *block, const char *name, +block_lookup_symbol_primary (const struct block *block, + const lookup_name_info &name, const domain_search_flags domain) { - lookup_name_info lookup_name (name, symbol_name_match_type::FULL); - /* 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, &lookup_name)) + for (symbol *sym : block_iterator_range (block, &name)) { /* With the fix for PR gcc/debug/91507, we get for: ... diff --git a/gdb/block.h b/gdb/block.h index 75f5c8e93944342782343ebfb9b5b99afce1d4ff..c348c7fdcc4088e7f5c912e49c387e2c650eda45 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -636,7 +636,7 @@ extern struct symbol *block_lookup_symbol (const struct block *block, extern struct symbol *block_lookup_symbol_primary (const struct block *block, - const char *name, + const lookup_name_info &name, const domain_search_flags domain); /* Find symbol NAME in BLOCK and in DOMAIN. This will return a diff --git a/gdb/symtab.c b/gdb/symtab.c index 508374f1358e92108db7546246e2323c5d7b5905..4822b5681f8370394c9cb6ca6c38ac2214191a39 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2365,6 +2365,7 @@ lookup_symbol_in_objfile_symtabs (struct objfile *objfile, block_index == GLOBAL_BLOCK ? "GLOBAL_BLOCK" : "STATIC_BLOCK", name, domain_name (domain).c_str ()); + lookup_name_info lookup_name (name, symbol_name_match_type::FULL); struct block_symbol other; other.symbol = NULL; for (compunit_symtab *cust : objfile->compunits ()) @@ -2375,7 +2376,7 @@ lookup_symbol_in_objfile_symtabs (struct objfile *objfile, bv = cust->blockvector (); block = bv->block (block_index); - result.symbol = block_lookup_symbol_primary (block, name, domain); + result.symbol = block_lookup_symbol_primary (block, lookup_name, domain); result.block = block; if (result.symbol == NULL) continue; -- 2.46.1