From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KO0AKwPQ7WdUkSQAWB0awg (envelope-from ) for ; Wed, 02 Apr 2025 20:02:11 -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=p133gCnG; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id ACCF91E0C3; Wed, 2 Apr 2025 20:02:11 -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 4D8591E0C0 for ; Wed, 2 Apr 2025 20:02:11 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E76213856942 for ; Thu, 3 Apr 2025 00:02:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E76213856942 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=p133gCnG Received: from omta38.uswest2.a.cloudfilter.net (omta38.uswest2.a.cloudfilter.net [35.89.44.37]) by sourceware.org (Postfix) with ESMTPS id 8CFDE384CB87 for ; Wed, 2 Apr 2025 23:45:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8CFDE384CB87 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 8CFDE384CB87 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1743637523; cv=none; b=MI2asFFEN8Fe7T68q3ODXIAzCpF7M+Jr+Oyc/yI9N2Hx0PdV7sSWITLMDeBeeg/8g01X0sMQDAaCRQjDxAvMPtnSGO2x94dWEK9HhiX2KcktonZeb+24gsDVpdjO5sTltPKs4zfEpmT9PV46X/8ujycbo9Ba8CAq2NhdHWeaCwk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1743637523; c=relaxed/simple; bh=5YNN/IgSxdEA3mKHt10qGKY7xPFfrSx6m9aAcFNie6E=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=uPDpxY9SxiCYeRtfxLwkk/NXeKagYFLXg34p61HwVA1ekAGVWCnd4MXXNxUa+G2FVovz+9xuBT+IEHME+PUAKBhG32EjYLcpIYzuIk2vCO9m3phvFIQsgdTrpDn78b+37bOvJXYPj7qHurxl7OtJVNOv8lezAyPvE1bgUha8HlQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8CFDE384CB87 Received: from eig-obgw-6010a.ext.cloudfilter.net ([10.0.30.248]) by cmsmtp with ESMTPS id zzcxt5axKAfjw07lquUDWT; Wed, 02 Apr 2025 23:45:22 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id 07lqufSBYqEhj07lqu3V1V; Wed, 02 Apr 2025 23:45:22 +0000 X-Authority-Analysis: v=2.4 cv=SMVEVvvH c=1 sm=1 tr=0 ts=67edcc12 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=ItBw4LHWJt0A:10 a=JL5VENfxr3PKjzKsgWAA:9 a=+jEqtf1s3R9VXZ0wqowq2kgwd+I=:19 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=Fxnsm0WxfdOTWqpUE1QH0kfgksJVRbpcc6s5gxll9MI=; b=p133gCnGetAepY747ORpUF1Xnu m7j/wZWQE+ceAXMaKPy5WxS3VBLEBIKRM5X4sbBTuNNrgum7g1JpnDrjfmb4kJDKfiywXoNn9zA6B mP5Ack0llRLmymTzRdN62Vije; 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 1u07lq-000000014hd-09e9; Wed, 02 Apr 2025 17:45:22 -0600 From: Tom Tromey Date: Wed, 02 Apr 2025 17:45:27 -0600 Subject: [PATCH v2 28/28] Remove enter_symbol_lookup MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20250402-search-in-psyms-v2-28-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: 1u07lq-000000014hd-09e9 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: 29 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfHWkDxby4GBFfeGRRwZfYaFUDVyZWi0035bvO6ANA4xOIdfGakb7ooTB3e6ee2NmW8iijtEttyHnLZM84Llw8jKHM7rUtqA6XzjDB7M4LVEFkw4hnzO1 9qeN6Iuyb0Af7pP0paeDeEzMs7YzBlfNBr2IK2m6aB27K2cqKGNMCHgu5MkprDDRPraf+UkMYY5S89MkNYeyB1t8bcuncFHZG6w= 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 The "enter_symbol_lookup" class was introduced to work around the lack of reentrancy in symbol lookup. There were two problems here: 1. The DWARF reader kept a mark bit on the dwarf2_per_cu_data object. This bit is gone now, replaced with a local mark vector. 2. Some spots in gdb first examined the expanded symbol tables, and then on failure expanded some symtabs and searched the newly expanded ones (skipping previousy-expanded ones). Fixing this has been the main point of this series. Now that both of these barriers are gone, I think enter_symbol_lookup can be removed. One proof of this idea is that, without the first fix mentioned above, py-symbol.exp regressed because gdbpy_lookup_static_symbols did not first ensure that the current language was set -- i.e., there was a latent bug in the enter_symbol_lookup patch anyway. --- gdb/symtab.c | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/gdb/symtab.c b/gdb/symtab.c index 16e0628b49bca17cd955f7be544128da47e69bc7..1bc54e8760c7075b3ec5a38c0c16dcbdbe16e25e 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -124,41 +124,6 @@ struct main_info static const registry::key main_progspace_key; -/* Symbol lookup is not reentrant (though this is not an intrinsic - restriction). Keep track of whether a symbol lookup is active, to be able - to detect reentrancy. */ -static bool in_symbol_lookup; - -/* Struct to mark that a symbol lookup is active for the duration of its - lifetime. */ - -struct enter_symbol_lookup -{ - enter_symbol_lookup () - { - /* Ensure that the current language has been set. Normally the - language is set lazily. However, when performing a symbol lookup, - this could result in a recursive call into the lookup code in some - cases. Set it now to ensure that this does not happen. */ - get_current_language (); - - /* Detect symbol lookup reentrance. */ - gdb_assert (!in_symbol_lookup); - - in_symbol_lookup = true; - } - - ~enter_symbol_lookup () - { - /* Sanity check. */ - gdb_assert (in_symbol_lookup); - - in_symbol_lookup = false; - } - - DISABLE_COPY_AND_ASSIGN (enter_symbol_lookup); -}; - /* The default symbol cache size. There is no extra cpu cost for large N (except when flushing the cache, which is rare). The value here is just a first attempt. A better default @@ -2294,8 +2259,6 @@ lookup_symbol_in_block (const char *name, symbol_name_match_type match_type, const struct block *block, const domain_search_flags domain) { - enter_symbol_lookup tmp; - struct symbol *sym; if (symbol_lookup_debug) @@ -2331,8 +2294,6 @@ lookup_global_symbol_from_objfile (struct objfile *main_objfile, const char *name, const domain_search_flags domain) { - enter_symbol_lookup tmp; - gdb_assert (block_index == GLOBAL_BLOCK || block_index == STATIC_BLOCK); for (objfile *objfile : main_objfile->separate_debug_objfiles ()) @@ -2633,8 +2594,6 @@ lookup_global_or_static_symbol (const char *name, return result; } - enter_symbol_lookup tmp; - /* Do a global search (of global blocks, heh). */ if (result.symbol == NULL) gdbarch_iterate_over_objfiles_in_search_order -- 2.46.1