From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta036.useast.a.cloudfilter.net (omta036.useast.a.cloudfilter.net [44.202.169.35]) by sourceware.org (Postfix) with ESMTPS id CABD4384773E for ; Thu, 23 Nov 2023 05:32:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CABD4384773E 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 CABD4384773E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700717531; cv=none; b=tFfMCRjrAOvQ/Qf8OIOZk9NOcnffm96N8gQo63hF7BUu4DT36A1Y9itSlHVvwFOV+azurj1/usiYSKQnYHGr0zrEk2/f3usjjcJ0S1cGbKpdgAeF9aQkBTE2CtQBP3dV2AQuyvguElc/INHv5VBR2zRi2fukYMnc9AGg8WXbQBA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700717531; c=relaxed/simple; bh=l8AdO2M8jxXRMdaUjiZ7zIX+DFgyTyC5mBrX0JuNBAM=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=EFJoLsfbvG0h7/aadR9sfwy0eaxp0UQcfPD89pRVq53I5ELNY7JpwF7qjtN+zrwCJmyIagcvpqp2epMp749pDtVgMI8oAxcWWKkoo+dKTt4J8Ur4967vD29hideStsQb+aK3eZq4NBQ4vKIXS9sM+evHCxBz4fUFaKdHnEwi3kI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6004a.ext.cloudfilter.net ([10.0.30.197]) by cmsmtp with ESMTPS id 61otrX7xWgpyE62Jqrd5qh; Thu, 23 Nov 2023 05:32:06 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id 62JorVwthRGmS62JprjxIv; Thu, 23 Nov 2023 05:32:05 +0000 X-Authority-Analysis: v=2.4 cv=efcuwpIH c=1 sm=1 tr=0 ts=655ee3d5 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=iZoEup0oKZo78n3hRxoA: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=pxuwrswvRtweiB4H182KEa+lP0RdKERCTjSDhzAQbiw=; b=GP+KGTddi0DHI0Gli7VWHjmnXT HbymZ+ncRmt63gUNlWiA1aGrD7fW0fu2m4Z9eZexVu1bSuHtYzYXIHHuw7eeZKWRHh0i1XExyysOf 9YEXklZWiq1fMbAkZu+0Z5Dc6; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:46354 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 1r62Jo-003TGR-2G for gdb-patches@sourceware.org; Wed, 22 Nov 2023 22:32:04 -0700 From: Tom Tromey Date: Wed, 22 Nov 2023 22:32:26 -0700 Subject: [PATCH v3 17/18] Avoid language-based lookups in startup path MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231122-t-bg-dwarf-reading-v3-17-fc3180de63c4@tromey.com> References: <20231122-t-bg-dwarf-reading-v3-0-fc3180de63c4@tromey.com> In-Reply-To: <20231122-t-bg-dwarf-reading-v3-0-fc3180de63c4@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: 1r62Jo-003TGR-2G 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]:46354 X-Source-Auth: tom+tromey.com X-Email-Count: 19 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfGMiZQ9x/Y4l3idctnrQ6+iq3qmAPxktbUYuB/LGpOb2v/8/0xueTSRLBFPbc3osiEIpGym2poOhdlK5NoszZHBHcentUsx4ErqNbSjlRzqAuuhNNABw 4mxv1szHiK23VuA6X3JLNTy0iXfxz/hJ/Swt9rzZ/6WjCWp5Uuf/nuUC4YLi6AGHGcU6jMt0V6s3uEvVv6r6EPc+7JgRREX5D/k= 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_DNSWL_NONE,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 List-Id: The previous patches are nearly enough to enable background DWARF reading. However, this hack in language_defn::get_symbol_name_matcher causes an early computation of current_language: /* If currently in Ada mode, and the lookup name is wrapped in '<...>', hijack all symbol name comparisons using the Ada matcher, which handles the verbatim matching. */ if (current_language->la_language == language_ada && lookup_name.ada ().verbatim_p ()) return current_language->get_symbol_name_matcher_inner (lookup_name); I considered various options here -- reversing the order of the checks, or promoting the verbatim mode to not be a purely Ada feature -- but in the end found that the few calls to this during startup could be handled more directly. In the JIT code, and in create_exception_master_breakpoint_hook, gdb is really looking for a certain kind of symbol (text or data) using a linkage name. Changing the lookup here is clearer and probably more efficient as well. In create_std_terminate_master_breakpoint, the lookup can't really be done by linkage name (it would require relying on a certain mangling scheme, and also may trip over versioned symbols) -- but we know that this spot is C++-specific, and so the language ought to be temporarily set to C++ here. After this patch, the "file" case is much faster: (gdb) file /tmp/gdb 2023-10-23 13:16:54.456 - command started Reading symbols from /tmp/gdb... 2023-10-23 13:16:54.520 - command finished Command execution time: 0.225906 (cpu), 0.064313 (wall) --- gdb/breakpoint.c | 4 +++- gdb/jit.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index af395fde14a..30ae3bccfd4 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -3733,6 +3733,8 @@ create_std_terminate_master_breakpoint (void) const char *const func_name = "std::terminate()"; scoped_restore_current_program_space restore_pspace; + scoped_restore_current_language save_language; + set_language (language_cplus); for (struct program_space *pspace : program_spaces) { @@ -3845,7 +3847,7 @@ create_exception_master_breakpoint_hook (objfile *objfile) { struct bound_minimal_symbol debug_hook; - debug_hook = lookup_minimal_symbol (func_name, NULL, objfile); + debug_hook = lookup_minimal_symbol_text (func_name, objfile); if (debug_hook.minsym == NULL) { bp_objfile_data->exception_msym.minsym = &msym_not_found; diff --git a/gdb/jit.c b/gdb/jit.c index 0e3a4285bdd..85a10be3055 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -880,7 +880,7 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, program_space *pspace) /* Lookup the registration symbol. If it is missing, then we assume we are not attached to a JIT. */ bound_minimal_symbol reg_symbol - = lookup_minimal_symbol (jit_break_name, nullptr, the_objfile); + = lookup_minimal_symbol_text (jit_break_name, the_objfile); if (reg_symbol.minsym == NULL || reg_symbol.value_address () == 0) { @@ -890,7 +890,7 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, program_space *pspace) } bound_minimal_symbol desc_symbol - = lookup_minimal_symbol (jit_descriptor_name, NULL, the_objfile); + = lookup_minimal_symbol_linkage (jit_descriptor_name, the_objfile); if (desc_symbol.minsym == NULL || desc_symbol.value_address () == 0) { -- 2.41.0