From patchwork Sun Nov 12 20:25:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 79662 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 9A14D3858296 for ; Sun, 12 Nov 2023 20:26:25 +0000 (GMT) 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 603663858D39 for ; Sun, 12 Nov 2023 20:25:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 603663858D39 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 603663858D39 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=1699820737; cv=none; b=XXZ5/ItNO2MbnPNWsavrshh2b4rLhJT/v72qT3DEawOs+rqFZzuSgdFSNUshTj0DJjrUkYHZuqYcOOtu72Nbnv2t+KZPWt2Xk7zcoe1djsX6iNnbgErb5RRt+Phin3KcWpE1R3VfbHU2sykIO2Q1ORl5ssctCFQuMBDYDNyZa/g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699820737; c=relaxed/simple; bh=u6oXx0HIduouTIm65Olk7mQDFQ2iI8fJhKMJxV1SUWs=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=o56Gb3bSSqUZkwF6gDkS2PvAktuN4bQbdfp4iaLjWO3+WuD11+gf3wA6wDMCBin9nWgQCJvjX34X6oACZpwBXIzVwjvN6mUSyj1+8PWiZ7PDTc7fqUl053yN/2NXbASLUxRF/2NggjNJ95Vtt5uukb49kgFfY9bNMVaQYg3W354= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6001a.ext.cloudfilter.net ([10.0.30.140]) by cmsmtp with ESMTPS id 23Vsr85MhWcCI2H1SrP2hl; Sun, 12 Nov 2023 20:25:34 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id 2H1RrmL01b8Qn2H1RrB9EQ; Sun, 12 Nov 2023 20:25:33 +0000 X-Authority-Analysis: v=2.4 cv=IuQNzZzg c=1 sm=1 tr=0 ts=655134bd 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=IPg9qJz9c1GkRlobM_gA: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=Fl2YnyOfxRveJpIQKTT9quy7syxUFlEaFDhQmX9OaBg=; b=UZ3gz3mTjqzF8m2lvzoY+G85q8 YQncyc1nAmQxtyCsXdjeAjk5Q1rC5sZ6K1WyzbC6q6auVXvYu+XkBw7VydhJoyo8ZO0hHCAqaP2+S Tw0TMj3S4dkhsvxijgqMytFGu; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:34540 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 1r2H1R-000cUU-07 for gdb-patches@sourceware.org; Sun, 12 Nov 2023 13:25:33 -0700 From: Tom Tromey Date: Sun, 12 Nov 2023 13:25:47 -0700 Subject: [PATCH v2 10/18] Change how cooked index waits for threads MIME-Version: 1.0 Message-Id: <20231112-t-bg-dwarf-reading-v2-10-70fb170012ba@tromey.com> References: <20231112-t-bg-dwarf-reading-v2-0-70fb170012ba@tromey.com> In-Reply-To: <20231112-t-bg-dwarf-reading-v2-0-70fb170012ba@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: 1r2H1R-000cUU-07 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]:34540 X-Source-Auth: tom+tromey.com X-Email-Count: 11 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfCspAEAhe6UZVV8iJR2dzXh9ocj2itTX5v5zh4EmxFJVJOVu51PNLlvKweDvJxHQq7s9yioHtqtc/cZEtl/7EEk7BFYZcLNQm+7ucP0ui6ExM2hurTmd iw2mrIsojlaZ9eFIeajiGO/1uLVlytJPMKhm4w5cVq6ctbfF8Rece5P/xphJ2NXOUtcJiT4IJh1CFvH86TJyA7JFutSDyz1jE1Q= X-Spam-Status: No, score=-3024.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, 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 This changes the cooked index code to wait for threads in its public-facing API. That is, the waits are done in cooked_index now, and never in the cooked_index_shard. Centralizing this decision makes it easier to wait for other events here as well. --- gdb/dwarf2/cooked-index.c | 3 +-- gdb/dwarf2/cooked-index.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c index 58ea541a5c9..a474691cfb4 100644 --- a/gdb/dwarf2/cooked-index.c +++ b/gdb/dwarf2/cooked-index.c @@ -405,8 +405,6 @@ cooked_index_shard::do_finalize () cooked_index_shard::range cooked_index_shard::find (const std::string &name, bool completing) const { - wait (); - cooked_index_entry::comparison_mode mode = (completing ? cooked_index_entry::COMPLETE : cooked_index_entry::MATCH); @@ -529,6 +527,7 @@ cooked_index::get_addrmaps () const cooked_index::range cooked_index::find (const std::string &name, bool completing) const { + wait (); std::vector result_range; result_range.reserve (m_vector.size ()); for (auto &entry : m_vector) diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h index 0db6e8003b9..14352c1e139 100644 --- a/gdb/dwarf2/cooked-index.h +++ b/gdb/dwarf2/cooked-index.h @@ -287,7 +287,6 @@ class cooked_index_shard /* Return a range of all the entries. */ range all_entries () const { - wait (); return { m_entries.cbegin (), m_entries.cend () }; } @@ -460,6 +459,7 @@ class cooked_index : public dwarf_scanner_base /* Return a range of all the entries. */ range all_entries () const { + wait (); std::vector result_range; result_range.reserve (m_vector.size ()); for (auto &entry : m_vector)