From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id F2CA23858017 for ; Wed, 4 Oct 2023 02:07:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F2CA23858017 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 3942739k018717 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 3 Oct 2023 22:07:08 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 3942739k018717 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1696385228; bh=j4HaqsaDSs+ZfJ85cI+lFqwbuideMEP0nGusNHjOzCE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NXvnoFDeEw7kxzxCyQpT71kE50VhMeAhcaZBEJguk2xl/FF5V96awcXQBFaKPDUOX pqq+2tnypvrrM38vCOepe+N08szXgjnOzKMVGevu2EAdHLWtHM3Th9OLSPqAEZwBxY zxkDt9rA6hW7J38zFsKf6uFUY/sMy3YVESzu4ThQ= Received: from simark.localdomain (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id B3EB01E0C3; Tue, 3 Oct 2023 22:07:03 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 2/3] gdb: add remote_state::{is_async_p,can_async_p} Date: Tue, 3 Oct 2023 22:04:00 -0400 Message-ID: <20231004020701.260411-3-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231004020701.260411-1-simon.marchi@polymtl.ca> References: <20231004020701.260411-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 4 Oct 2023 02:07:03 +0000 X-Spam-Status: No, score=-3188.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP 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: From: Simon Marchi A subsequent patch will want to know if the remote is async within a remote_state method. Add a helper method for that, and for "can async" as well, for symmetry. Change-Id: Id0f648ee4896736479fa942f5453eeeb0e5d4352 --- gdb/remote.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/gdb/remote.c b/gdb/remote.c index 2deba06d7d47..38d0027dbf9e 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -438,6 +438,20 @@ class remote_state ::delete_async_event_handler (&m_async_event_handler_token); } + bool is_async_p () const + { + /* We're async whenever the serial device is. */ + return (this->remote_desc + != nullptr && serial_is_async_p (this->remote_desc)); + } + + bool can_async_p () const + { + /* We can async whenever the serial device can. */ + return (this->remote_desc + != nullptr && serial_can_async_p (this->remote_desc)); + } + public: /* data */ /* A buffer to use for incoming packets, and its current size. The @@ -14853,16 +14867,14 @@ remote_target::can_async_p () gdb_assert (target_async_permitted); /* We're async whenever the serial device can. */ - struct remote_state *rs = get_remote_state (); - return serial_can_async_p (rs->remote_desc); + return get_remote_state ()->can_async_p (); } bool remote_target::is_async_p () { /* We're async whenever the serial device is. */ - struct remote_state *rs = get_remote_state (); - return serial_is_async_p (rs->remote_desc); + return get_remote_state ()->is_async_p (); } /* Pass the SERIAL event on and up to the client. One day this code -- 2.42.0