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 DBACF38582A7 for ; Wed, 17 Jan 2024 16:39:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DBACF38582A7 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 DBACF38582A7 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=1705509584; cv=none; b=VP76ENMNVxEdvTxArI7Axpsp4yCtpJmcGuXbM+dLLclwU6KaC/+mGtHcUJMiBC53SvKmWrP5IFVNnhAPI6qdpUm+YhWdS3tM0iyeoi0eyyIfytMwBd4r9aG2elx4cdMWQnd/ZJTkTNsoMtNByul2Z3B6WTwzUEet+cZo8V0qtWA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705509584; c=relaxed/simple; bh=2ctjMn6OU08f/NLj6OxD+TljoeFnegPJrXvLBG5Xy3c=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=xrrNjECllkk24QLj6rjPgtAFdbAPofzctXnYY+N4gccVjcde4FMl8AjDLYLBM2mdJfji0vRgJjA8xFwzxaHbfELSYK01NP2FcPpcjIPjoj3eJdqznS48aCFDYz8ebcNsIvWnRFF6LJqBoMQA7zDjJ9FZrOCqR368rStSlUWzYFQ= 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 Q7Zjr5UmKCF6GQ8x1re7XD; Wed, 17 Jan 2024 16:39:39 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id Q8x0rN9aJ1UTRQ8x0rMwUj; Wed, 17 Jan 2024 16:39:39 +0000 X-Authority-Analysis: v=2.4 cv=ZOXEJF3b c=1 sm=1 tr=0 ts=65a802cb 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=_Q59pEjegqlOl41-1dcA: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=WWsuyhWsZ0xIL5vFcOEWQHejBfqUNaFZ5qLDPXsA30w=; b=PKrnx1H0heI1AGsDwumr+OPJPW LSihTkdBR7grztFZ7MsotcpLhGRdUy22qK2BsdTVAs57pdHaoPSIahzBxkNAbEApCmu5KaXbHzLzN WYEPvalL4kTOlHkn/tc+aF3n+; 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 1rQ8x0-002OXE-11 for gdb-patches@sourceware.org; Wed, 17 Jan 2024 09:39:38 -0700 From: Tom Tromey Date: Wed, 17 Jan 2024 09:39:37 -0700 Subject: [PATCH v2 09/17] Remove cooked_index_worker::start_reading MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240117-debug-names-fix-v2-9-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: 1rQ8x0-002OXE-11 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: 14 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfIMkgJ6YVhv8tkumNiqow/ThEbOMLcEdq03CBc4YGWlT5KnSQE/rxVQc8UCWIwGYrUeuiO0KhIOYQQGHrhIEbnC8Xj96TsOeT/P54qebYXQWbJouPA6g AqlCiBbX6K90qoK1KTt9Qzr+8WbEV06T7X0ZfWzeyu15VmidHRvmQGi0DZxcfHHBoqfKL9/s1y5oFwuzZ3PhKUwJ+eLmBGB4xgo= X-Spam-Status: No, score=-3022.6 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: 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 97a749f97e8..d5a21ee9dec 100644 --- a/gdb/dwarf2/cooked-index.c +++ b/gdb/dwarf2/cooked-index.c @@ -449,26 +449,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. */ @@ -520,7 +512,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 f063fe088e8..86fbb8ffac4 100644 --- a/gdb/dwarf2/cooked-index.h +++ b/gdb/dwarf2/cooked-index.h @@ -534,13 +534,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 @@ -579,9 +574,9 @@ class cooked_index_worker arose during scanning have been reported by 'wait'. This may only be modified on the main thread. */ bool m_reported = false; - /* 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; }; -- 2.43.0