From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta040.useast.a.cloudfilter.net (omta040.useast.a.cloudfilter.net [44.202.169.39]) by sourceware.org (Postfix) with ESMTPS id D884D3858427 for ; Sun, 10 Dec 2023 16:45:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D884D3858427 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 D884D3858427 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=1702226707; cv=none; b=lTdkHVlnBpMUKIOzDBk1b5jbN17eFsrCLwFUCwMyYgVoa8P0NLuoRMvBaSV4iOB0VZJ3rfbO++XUAf6GlA+mLzXzjwohWS5Ir82ZuHOgR9rCWW2Nk3pV4ikUwATIyu4+j12fQETX3hRgsgjol9DZogGQ8Jo0YwcSvxo+TwCsqDM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702226707; c=relaxed/simple; bh=1zE1ukHqgVd4zdrb2dzW7X44U0/Ni8JrvDubmB4fvuE=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=o+mYMeI1BY+qz2+Sr763X4ktKs3xE0234jQSYB2RuV0M3fg4Nh17BUMYXa/F1jBemi7J5XXx4uIX55eoBEgR5MadW9k1IH/4h/Jkw7SrPO8Ys2+zYE5Q8UIuyg1dWtrhObuK6Gk2B+/5gWuSjNu9RH1RMzqNyzIoxsg7gGMuSZY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6005a.ext.cloudfilter.net ([10.0.30.201]) by cmsmtp with ESMTPS id CJshrW0Lq6nOZCMvQrqukX; Sun, 10 Dec 2023 16:45:04 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id CMvPrjlNh8KNvCMvQrewHl; Sun, 10 Dec 2023 16:45:04 +0000 X-Authority-Analysis: v=2.4 cv=dp3Itns4 c=1 sm=1 tr=0 ts=6575eb10 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=QVOhxxRJGtlG8CAijpQA: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=RUOGUsf7opmkiWRXxDCI24vmRRsRLUrWkB8PiKvU7dI=; b=N8zmYw1KLtm5vT9x0A3B/LUHjH bOg2Ig8+2m2kWacOgvMCKlo/6UMIQ1GZlqb7zNsp746COHbA5CvtlciNoaT66ObWf8ElMCBby1fYe Y/CzHzaPiu1/ptidbTbdThqed; 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 1rCMvP-001rpu-1t for gdb-patches@sourceware.org; Sun, 10 Dec 2023 09:45:03 -0700 From: Tom Tromey Date: Sun, 10 Dec 2023 09:44:57 -0700 Subject: [PATCH 08/17] Do not write the index cache from an index MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231210-debug-names-fix-v1-8-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: 1rCMvP-001rpu-1t 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: 9 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfGbsrbGiVOjl7g9w4Swpe02cDj2ZBuFCqz3I6vXDI9j4+BXbHO64ziHSDN90XciP6RMsUdAELkclexkVfRkp0YZ86jrHRFSOvooH5Ne8qdIxKPcsIfxu 7Zh+7t18OWJS64KwKHAvh+3BmpKxfw2P7py39A+mqpNIyOHxmR4AG5Zlurba8EiiFSUN/0Ht4fRxXIEcUQvijXDtT8BbdJ6VSf0= X-Spam-Status: No, score=-3024.3 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 new .debug_names reader will work by creating a cooked index from .debug_names. This patch updates cooked_index::maybe_write_index to avoid writing the index in this case. However, in order to do this in a clean way, the readers are changed so that a nullptr result from index_for_writing means "cannot be done", and then the error message is moved into write_dwarf_index (where it historically lived). --- gdb/dwarf2/cooked-index.c | 7 +++++-- gdb/dwarf2/index-write.c | 2 ++ gdb/dwarf2/mapped-index.h | 4 +--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c index 684773cb192..a2bfe8e7b88 100644 --- a/gdb/dwarf2/cooked-index.c +++ b/gdb/dwarf2/cooked-index.c @@ -699,8 +699,11 @@ void cooked_index::maybe_write_index (dwarf2_per_bfd *per_bfd, const index_cache_store_context &ctx) { - /* (maybe) store an index in the cache. */ - global_index_cache.store (m_per_bfd, ctx); + if (index_for_writing () != nullptr) + { + /* (maybe) store an index in the cache. */ + global_index_cache.store (m_per_bfd, ctx); + } m_state->set (cooked_state::CACHE_DONE); } diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c index 44728e4216d..c23fa25e021 100644 --- a/gdb/dwarf2/index-write.c +++ b/gdb/dwarf2/index-write.c @@ -1620,6 +1620,8 @@ write_dwarf_index (dwarf2_per_bfd *per_bfd, const char *dir, if (per_bfd->index_table == nullptr) error (_("No debugging symbols")); cooked_index *table = per_bfd->index_table->index_for_writing (); + if (table == nullptr) + error (_("Cannot use an index to create the index")); if (per_bfd->types.size () > 1) error (_("Cannot make an index when the file has multiple .debug_types sections")); diff --git a/gdb/dwarf2/mapped-index.h b/gdb/dwarf2/mapped-index.h index fb15da9f8d5..d01f4df4622 100644 --- a/gdb/dwarf2/mapped-index.h +++ b/gdb/dwarf2/mapped-index.h @@ -127,9 +127,7 @@ struct mapped_index_base : public dwarf_scanner_base dwarf2_per_objfile *per_objfile) const; cooked_index *index_for_writing () override - { - error (_("Cannot use an index to create the index")); - } + { return nullptr; } }; #endif /* GDB_DWARF2_MAPPED_INDEX_H */ -- 2.43.0