From patchwork Tue Mar 11 14:13:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 107683 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 564353857839 for ; Tue, 11 Mar 2025 14:19:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 564353857839 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=cNF9lRtt X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta038.useast.a.cloudfilter.net (omta038.useast.a.cloudfilter.net [44.202.169.37]) by sourceware.org (Postfix) with ESMTPS id 7E7C63857C63 for ; Tue, 11 Mar 2025 14:12:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7E7C63857C63 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 7E7C63857C63 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1741702377; cv=none; b=Nu5Sl2jo6aSia4bS+aV5HWJ49T/VY1eWDkGlDCyHy+/WrMkU0fpYhwn+lygZkgGlxgs/mOMfrLFxIczKlRG20YGkH4Pekesp+5Ka3r+2WIs++qU74XdqjN5fdY1cEiwONh2n7Mrqdt+LEtYqpoDov1sgO4I7Jrl0p27OALpbwcg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1741702377; c=relaxed/simple; bh=Fsb3ZCJnqvaCGEILZpc4vs5RdUtSyS2jIpCNbad7Z24=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=MCGNxlY1j0AZKc1Vp0kqdlgPZyjvcgsRyVVCMLEPFHzasB1A2Bu0pq488/gwejQyFH3M/UBgRxD8GqjfIe0KCLqXN2hWxocfgXadCFYjTIUYCgL1K7Wh/XJ/L37etTptIx84uvr0UERkIK5ugMd+lPBWWmYEK3KvYoXS4IjO2wg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6003a.ext.cloudfilter.net ([10.0.30.151]) by cmsmtp with ESMTPS id rrintxT6ciuzSs0LptjU3o; Tue, 11 Mar 2025 14:12:57 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id s0LntlPztNMSls0Lot3UmW; Tue, 11 Mar 2025 14:12:56 +0000 X-Authority-Analysis: v=2.4 cv=K9DpHDWI c=1 sm=1 tr=0 ts=67d044e9 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=Vs1iUdzkB0EA: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=vSqbP1VBy+bxdHm4lA8fHdnOj6iYuo3Bhfl41eQVz4g=; b=cNF9lRttsfq37YtXrBCcKxV1Dg WPYbqt5uvi5hNt7dZ+PhD2BOvcNO7XSG+ZX2zjTZDhTIEyAgF84gRFd6vyWfeKXeSeZghZVyeyqlR MbfQwfrTNu8HlzaNFfNkZ5JqJ; Received: from 97-118-51-80.hlrn.qwest.net ([97.118.51.80]:33770 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 1ts0Ln-000000003jP-2Cy7; Tue, 11 Mar 2025 08:12:55 -0600 From: Tom Tromey Date: Tue, 11 Mar 2025 08:13:04 -0600 Subject: [PATCH 28/28] Remove enter_symbol_lookup MIME-Version: 1.0 Message-Id: <20250311-search-in-psyms-v1-28-d73d9be20983@tromey.com> References: <20250311-search-in-psyms-v1-0-d73d9be20983@tromey.com> In-Reply-To: <20250311-search-in-psyms-v1-0-d73d9be20983@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.118.51.80 X-Source-L: No X-Exim-ID: 1ts0Ln-000000003jP-2Cy7 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-118-51-80.hlrn.qwest.net (prentzel.local) [97.118.51.80]:33770 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: MS4xfDf8VBZhlOYDsvlidA5JESsPlB8w5+xM385gbdJnniFm7XaL8zXiobG4q1qbZkVPbYnR1Ufflmc04rWu9KYFH7SkyZultH7U6f4CODHP9t5lAXvH+OLW hLdPAnizA9wN4EUYjXJfc9/TS+gY2gEesYvv83G7olhdZpim39ShTCZVzlE80rMlqm7w7nYDjMTobjp0EKHvWm4/sQH4SMmpQsE= X-Spam-Status: No, score=-3016.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP 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 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 c325432f7af0f1f6811916406e7c8b902c5852ee..32a6a5a34fbfa6ad44ccb6a8f5eba921701add34 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