From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta36.uswest2.a.cloudfilter.net (omta36.uswest2.a.cloudfilter.net [35.89.44.35]) by sourceware.org (Postfix) with ESMTPS id 232FF3858434 for ; Wed, 17 Jan 2024 16:39:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 232FF3858434 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 232FF3858434 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705509579; cv=none; b=pPBv6kogncXNAo2wniW/VkSEDQRO8szzsTWNb/hyrlyjmXiCAVguUQxo29kjzbLUVS3KFmD+F4xAUGzWfweUkkOfLZe8uVjsLIjBdHN7t5EYKWFuAXEDtkP0UgxU/idUWwMDPDyR95NEZJB3fwxMDhrY+HV4e9Gvy5pFt2BmRyc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705509579; c=relaxed/simple; bh=EX8S2QH0q3HCi8OX+o3XZFzhaJblV70463YEJq/Fj1k=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=eyWSFbo2kP7RUu9Lq6QFMcChnDhwAjQ4zuY8LqPafWPF3eidHbnMrVvI7JiYznNEERL8uEZLhCAz53UD+/GZCIWZeTcOLKZb+A5mbzHOStZjbMltBK3U9v/HszynnjyUeISiLNUk/oUPZd0yLwnvWQxGaA68XgfgqkgkDa3IE54= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6010a.ext.cloudfilter.net ([10.0.30.248]) by cmsmtp with ESMTPS id Q4Jur4VDGCF6GQ8wzre7Vu; Wed, 17 Jan 2024 16:39:37 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id Q8wyrFUIVfPByQ8wyrJFL3; Wed, 17 Jan 2024 16:39:36 +0000 X-Authority-Analysis: v=2.4 cv=T+af8tGQ c=1 sm=1 tr=0 ts=65a802c8 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=dEuoMetlWLkA: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=lyLhm7XBqHX+wdVvcd4PqsYM0E+ovslAYUVgV93BFC4=; b=d+NBwMRm6TDe+CVVVn+25psm25 kBF2hCDMWnFKErToefCKlo7AkTh0GAMYmIEOrdlWy49WmnLiKiVkCD7FJfZUT7eEZ77A9PQdxl0g+ D/Gmm9fc7q5W8MPxLujQ+R+xt; Received: from 97-122-68-157.hlrn.qwest.net ([97.122.68.157]:56636 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 1rQ8wy-002OXE-0k for gdb-patches@sourceware.org; Wed, 17 Jan 2024 09:39:36 -0700 From: Tom Tromey Date: Wed, 17 Jan 2024 09:39:30 -0700 Subject: [PATCH v2 02/17] Refactor quick-function installation in DWARF reader MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240117-debug-names-fix-v2-2-dbd5971a9c31@tromey.com> References: <20240117-debug-names-fix-v2-0-dbd5971a9c31@tromey.com> In-Reply-To: <20240117-debug-names-fix-v2-0-dbd5971a9c31@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.68.157 X-Source-L: No X-Exim-ID: 1rQ8wy-002OXE-0k X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-68-157.hlrn.qwest.net ([192.168.0.21]) [97.122.68.157]:56636 X-Source-Auth: tom+tromey.com X-Email-Count: 6 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfNesHDx33+nnDKyVmMu6ssnEL9Tiv7eF2nwmw+NQr4uE3k4rZgY9/SDMteaZ5tmmxwZYemoQhENFNQ6VrJkbeKoU8OgaXMjPrumuJ+GcKufhRpMbO//p lkuQevweb0g43MVlQVVJnWMVpXWkmPYu79lLrbkXW0UiEoG9aDtkpunZcESRNUiBNnUJcah6/NBV9CK+/ODYdno1KxIbe/ZW+p4= X-Spam-Status: No, score=-3022.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,JMQ_SPF_NEUTRAL,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: 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 e0eb1f9ce3c..84cbc1ac9af 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; } @@ -16910,10 +16902,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. */ @@ -16923,8 +16915,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 -- 2.43.0