From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta038.useast.a.cloudfilter.net (omta038.useast.a.cloudfilter.net [44.202.169.37]) by sourceware.org (Postfix) with ESMTPS id 3AC7A3858436 for ; Sun, 10 Dec 2023 16:45:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3AC7A3858436 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 3AC7A3858436 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=1702226709; cv=none; b=GGNJu25OuwiX+z1ZMWuzp/0oxbDU0MWUASphd8MWawIbNahQXuF3qWBmplDj0L8wPY5zkTDTSHd0LsfA5Zvgm8NgtGjIkZqIUWYlfESFxQUjVf/v9U2djpk3zJ/qH/0WKLhyKG04mFh+BGiW9TW7JMUoNjLuWempr8G82zJTR70= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702226709; c=relaxed/simple; bh=YE61ksPDnWyLjOzSJPqsH55pvimRzPfpkEOydAKn7Nc=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=Xmynees+pXafyy6rgp/LU9+bMcQXVzbvxSj5mYEBw5cllQeR8U9UBDjU6RTsFIn5XWubxAVU9/XDSnV1MfzBakhqhsi0o/dMj31lE09/lm3OVShv6U8h8veNBfgKn6uTC+1eqiqjHAZH52GzBHLsU3mXg9JcgIIgEPmhjm7rNvA= 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 C64FrQBvQWcCICMvQrQZng; Sun, 10 Dec 2023 16:45:05 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id CMvQrjlO18KNvCMvQrewI7; 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=mwGyVCKTKvfLHOITJU0A: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=wrASWlFVu0iu4dC/F5ZBhgTHznsRkWb59U1NtS/0qHo=; b=tFc3V0b02bKAUua5Rh4/4qiMTc kAwi74cxMINtugRC8EtiWw0vNJdUFnsURFFW5QCpYYZfMD2ggcp6WNTURKJjdaWNXr/TfslbAHtwC 8CPJRaRNeFgJPe9pXML5x9zx/; 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-33 for gdb-patches@sourceware.org; Sun, 10 Dec 2023 09:45:03 -0700 From: Tom Tromey Date: Sun, 10 Dec 2023 09:44:59 -0700 Subject: [PATCH 10/17] Remove cooked_index_worker::start_reading MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231210-debug-names-fix-v1-10-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-33 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: 11 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.5 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 List-Id: I noticed that cooked_index_worker::start_reading isn't really needed. This patch removes it, and also removes the SCOPED_EXIT, in favor of a direct call. --- gdb/dwarf2/cooked-index.c | 32 ++++++++++++-------------------- gdb/dwarf2/cooked-index.h | 15 +++++---------- 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c index 604e7526c0f..ef4b3bf21fd 100644 --- a/gdb/dwarf2/cooked-index.c +++ b/gdb/dwarf2/cooked-index.c @@ -447,26 +447,18 @@ cooked_index_worker::start () { gdb::thread_pool::g_thread_pool->post_task ([=] () { - this->start_reading (); - }); -} - -/* See cooked-index.h. */ - -void -cooked_index_worker::start_reading () -{ - SCOPE_EXIT { bfd_thread_cleanup (); }; + try + { + do_reading (); + } + catch (const gdb_exception &exc) + { + m_failed = exc; + set (cooked_state::CACHE_DONE); + } - try - { - do_reading (); - } - catch (const gdb_exception &exc) - { - m_failed = exc; - set (cooked_state::CACHE_DONE); - } + bfd_thread_cleanup (); + }); } /* See cooked-index.h. */ @@ -514,7 +506,7 @@ cooked_index_worker::wait (cooked_state desired_state, bool allow_quit) if (m_failed.has_value ()) { - /* start_reading failed -- report it. */ + /* do_reading failed -- report it. */ exception_print (gdb_stderr, *m_failed); m_failed.reset (); return done; diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h index ffb7bf71e81..b76af00af29 100644 --- a/gdb/dwarf2/cooked-index.h +++ b/gdb/dwarf2/cooked-index.h @@ -480,13 +480,8 @@ class cooked_index_worker friend class cooked_index; void set (cooked_state desired_state); - /* Start reading DWARF. This can be run in a worker thread without - problems. */ - void start_reading (); - - /* Helper function that does most of the work for start_reading. - This must be able to be run in a worker thread without - problems. */ + /* Helper function that does the work of reading. This must be able + to be run in a worker thread without problems. */ virtual void do_reading () = 0; /* A callback that can print stats, if needed. This is called when @@ -518,9 +513,9 @@ class cooked_index_worker /* Mutex and condition variable used to synchronize. */ std::mutex m_mutex; std::condition_variable m_cond; - /* If set, an exception occurred during start_reading; in this case - the scanning is stopped and this exception will later be reported - by the 'wait' method. */ + /* If set, an exception occurred during reading; in this case the + scanning is stopped and this exception will later be reported by + the 'wait' method. */ std::optional m_failed; #endif /* CXX_STD_THREAD */ }; -- 2.43.0