From patchwork Sun Dec 10 16:44:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 81810 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 762213857C72 for ; Sun, 10 Dec 2023 16:45:25 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta040.useast.a.cloudfilter.net (omta040.useast.a.cloudfilter.net [44.202.169.39]) by sourceware.org (Postfix) with ESMTPS id 042833858D28 for ; Sun, 10 Dec 2023 16:45:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 042833858D28 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 042833858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702226706; cv=none; b=eoXlKwLt7YHtQwm427SCF8gyi43oFgcCZ4gY0PpGcaqKQMvFcZPHWDFxZmcZJFhh4oDaZXnvHfNjc1lfMYxmkgc+TYjy3G1moq9b12GA95H9j14ql9xy75EVhCpew1Ox/vP1/N5fhqt5Jm3fI+Y0fCXN9MAUHxo4PCSe+YxvtJ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702226706; c=relaxed/simple; bh=FJ7mKeqeHlqBrHr7MAgaf0s07Lsf2SNK2Y2QxpDLCVc=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=dTE2yk8AYIWaJTyLAUlyGqncSWR5psp0NCO4ojWFuKGu3okwB2L/deqP5h2FV83EyvTVYuiK4Ei+f4y/Zfzv4kcnFK+GEIcyd9fe1sgzQgYruMekyhG2KVaqc2TwD6jf7kUo1BpxRJ1WbcS1Xp3uw6MsE2f6hzuPpiRrm2KoYXM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5010a.ext.cloudfilter.net ([10.0.29.199]) by cmsmtp with ESMTPS id CJiNrVz096nOZCMvPrqujk; Sun, 10 Dec 2023 16:45:03 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id CMvOrwfCIhDnyCMvOr8GhQ; Sun, 10 Dec 2023 16:45:02 +0000 X-Authority-Analysis: v=2.4 cv=fda+dmcF c=1 sm=1 tr=0 ts=6575eb0e a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=e2cXIFwxEfEA:10 a=Qbun_eYptAEA:10 a=ypeVnOuJBbWFr2mRlmMA: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=ZkxXPgqMir0FeWuGYoX8vGWm3aQFz5jm2E+hf7AqJKs=; b=lwepJ55J4ODW+pcZ57tb2xcE8X wuZ0HN7fQJ684AgKsALsm7mTdt47VGbnLFG8NbUql3piES5AQhp7xY2nQxe02XTPqfZbhAf8P78j2 oUtKJPpqC5qTKsBKexoZSyQTO; Received: from [198.59.47.65] (port=52394 helo=[192.168.131.83]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1rCMvN-001rpu-36 for gdb-patches@sourceware.org; Sun, 10 Dec 2023 09:45:01 -0700 From: Tom Tromey Date: Sun, 10 Dec 2023 09:44:51 -0700 Subject: [PATCH 02/17] Refactor quick-function installation in DWARF reader MIME-Version: 1.0 Message-Id: <20231210-debug-names-fix-v1-2-a8f6d2525018@tromey.com> References: <20231210-debug-names-fix-v1-0-a8f6d2525018@tromey.com> In-Reply-To: <20231210-debug-names-fix-v1-0-a8f6d2525018@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: 198.59.47.65 X-Source-L: No X-Exim-ID: 1rCMvN-001rpu-36 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([192.168.131.83]) [198.59.47.65]:52394 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfPUgefnZg4QkQ9VlnhlFuPEeiSj2VAD6TOZNOij8zbALsNZwEn2fEzivdUUyn6nDUVfc/DQXarVfi+LCY/9FlMoK+zimB9lqUH57bU0UOdmwBIG0231H nyutu/d2eeKodyBXkWe5ZvobvfhzJpEfP1UpKavjqykqAwQottBbjV+ttBKOGJEy8IQAFa66a6Wchi/XYQP68S0Xi/hM58/aQRU= X-Spam-Status: No, score=-3023.9 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 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 While working on the previous patch, I saw that the handling of quick-function installation could be unified dwarf2_initialize_objfile. In particular, at the end of the function, if there is an index table, then it can be used to create the quick function object. This cleanup will be useful when rewriting the .debug_names reader. --- gdb/dwarf2/read.c | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index dc57af96275..7262de4cc19 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -3190,8 +3190,7 @@ get_gdb_index_contents_from_cache_dwz (objfile *obj, dwz_file *dwz) return global_index_cache.lookup_gdb_index (build_id, &dwz->index_cache_res); } -static quick_symbol_functions_up make_cooked_index_funcs - (dwarf2_per_objfile *); +static void start_debug_info_reader (dwarf2_per_objfile *); /* See dwarf2/public.h. */ @@ -3236,23 +3235,13 @@ dwarf2_initialize_objfile (struct objfile *objfile, /* Was a GDB index already read when we processed an objfile sharing PER_BFD? */ else if (per_bfd->index_table != nullptr) - { - dwarf_read_debug_printf ("re-using symbols"); - objfile->qf.push_front (per_bfd->index_table->make_quick_functions ()); - } + dwarf_read_debug_printf ("re-using symbols"); else if (dwarf2_read_debug_names (per_objfile)) - { - dwarf_read_debug_printf ("found debug names"); - objfile->qf.push_front - (per_bfd->index_table->make_quick_functions ()); - } + dwarf_read_debug_printf ("found debug names"); else if (dwarf2_read_gdb_index (per_objfile, get_gdb_index_contents_from_section, get_gdb_index_contents_from_section)) - { - dwarf_read_debug_printf ("found gdb index from file"); - objfile->qf.push_front (per_bfd->index_table->make_quick_functions ()); - } + dwarf_read_debug_printf ("found gdb index from file"); /* ... otherwise, try to find the index in the index cache. */ else if (dwarf2_read_gdb_index (per_objfile, get_gdb_index_contents_from_cache, @@ -3260,16 +3249,19 @@ dwarf2_initialize_objfile (struct objfile *objfile, { dwarf_read_debug_printf ("found gdb index from cache"); global_index_cache.hit (); - objfile->qf.push_front (per_bfd->index_table->make_quick_functions ()); } else { global_index_cache.miss (); - objfile->qf.push_front (make_cooked_index_funcs (per_objfile)); + start_debug_info_reader (per_objfile); } - if (dwarf_synchronous && per_bfd->index_table != nullptr) - per_bfd->index_table->wait_completely (); + if (per_bfd->index_table != nullptr) + { + if (dwarf_synchronous) + per_bfd->index_table->wait_completely (); + objfile->qf.push_front (per_bfd->index_table->make_quick_functions ()); + } return true; } @@ -16818,10 +16810,10 @@ cooked_index_functions::expand_symtabs_matching return true; } -/* Return a new cooked_index_functions object. */ +/* Start reading .debug_info using the indexer. */ -static quick_symbol_functions_up -make_cooked_index_funcs (dwarf2_per_objfile *per_objfile) +static void +start_debug_info_reader (dwarf2_per_objfile *per_objfile) { /* Set the index table early so that sharing works even while scanning; and then start the scanning. */ @@ -16831,8 +16823,6 @@ make_cooked_index_funcs (dwarf2_per_objfile *per_objfile) /* Don't start reading until after 'index_table' is set. This avoids races. */ idx->start_reading (); - - return quick_symbol_functions_up (new cooked_index_functions); } quick_symbol_functions_up