From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id sZL1IVSwo2pSKj8AWB0awg (envelope-from ) for ; Fri, 11 Sep 2026 03:40:04 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=M09jn01T; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 867C81E09E; Fri, 11 Sep 2026 03:40:04 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (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 ESMTPS id E96591E091 for ; Fri, 11 Sep 2026 03:40:03 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9F8B9490140C for ; Fri, 11 Sep 2026 07:40:03 +0000 (GMT) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by sourceware.org (Postfix) with ESMTPS id 9BB5F4AA6FED for ; Fri, 11 Sep 2026 07:39:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9BB5F4AA6FED Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9BB5F4AA6FED Authentication-Results: sourceware.org; arc=none smtp.remote-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789112393; cv=none; b=nIoJB0/94qDm8ftUTBTkN5uuQIeBlAHHN59Ido3qTkxzOvp2LzsZOyodES8i6RuQi/i9CVywNX71+Zp8jsCnJfylYBRLI0FbFxWsEQfMSzeukVrFrwk8Y+DtMEnHxLycFjEi7SCfAz0sd8I0+e1ZLuIcUNIbcutf+8jtg6Rs2FM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789112393; c=relaxed/simple; bh=1GUWjsmc1OEu/FRuY69L4OOO+BUUufHdl7+OBxL4Zxc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vRAilw5paW894m3IpPhn5eFGRZl0ZuZyRwqStiDLiJbOy1QwjBpqOECU2we1Mf3YvfAQYqocuEg8KZ8GnfBlGGW+6LrIqf0OKL/tTpPJIEcbILfAbyczN10TTBik0vyqDkNf4PeyrNA5Pcv4SgdtIJuBtesysbniDL9VUPOYX18= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=M09jn01T DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9BB5F4AA6FED Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=M09jn01T DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1789112394; x=1820648394; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1GUWjsmc1OEu/FRuY69L4OOO+BUUufHdl7+OBxL4Zxc=; b=M09jn01TLh+AZdyeDicWn5FFlNERHtMlv82anRnk9atudZR30AVdmDiJ ruyPzwFKMS8xru8b+wFtR1T0HeLTMlDZGwz4v+tk0l6HbNXJWHkxCNSVi Db+K3fhJ0XJdoWi5CjebkRrDSMUpkFsFEawp0WVhoPuenjnSzI84x/25G b8T9JvfstE5jxx74Z/Fl9plv5wnZD9K8YX3VUe5clNcT5qk9XtlPgycDs fNWC4H38KcfRIGTb7tmMi+5s831PO+A4+3s8V2NszV3WpIaGPjNIz7W0u T0LjsRAhY9LGiR9iZXf66Tp9fjr0ZSU5abgnVXToOYRFkrBf7IOSAYqpc A==; X-CSE-ConnectionGUID: NFgmDcYqSkWfWhtxs+GSkQ== X-CSE-MsgGUID: BNOcn09SQZiSRE4MD4vg/g== X-IronPort-AV: E=McAfee;i="6800,10657,11901"; a="93440513" X-IronPort-AV: E=Sophos;i="6.27,96,1787036400"; d="scan'208";a="93440513" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2026 00:39:53 -0700 X-CSE-ConnectionGUID: xOFL4BpCQOmBYHtemLpfwQ== X-CSE-MsgGUID: 1Jwwo4R5QSiAQGLrZljSMg== X-ExtLoop1: 1 Received: from dut1028pvc.igk.intel.com (HELO localhost) ([10.211.177.254]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2026 00:39:52 -0700 From: Stephan Rohr To: gdb-patches@sourceware.org Cc: tom@tromey.com Subject: [PATCH v3 2/2] gdb, remote: Skip sending of 'vCont' packet if remote target is empty Date: Fri, 11 Sep 2026 07:39:10 +0000 Message-ID: <20260911073910.17936-3-stephan.rohr@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260911073910.17936-1-stephan.rohr@intel.com> References: <20260911073910.17936-1-stephan.rohr@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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~public-inbox=simark.ca@sourceware.org From: "Rohr, Stephan" If the remote target has no threads that need to be stopped, we can skip sending the 'vCont' package in 'remote_stop_ns'. --- gdb/remote.c | 4 ++++ .../interrupt-empty-remote-target.exp | 17 ++++++++++++++++- gdb/thread-iter.h | 3 +++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/gdb/remote.c b/gdb/remote.c index 76cf6b5234f..595384e56bb 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -7884,6 +7884,10 @@ remote_target::remote_stop_ns (ptid_t ptid) } } + /* Skip 'vCont' packet if there are no threads to be stopped. */ + if (all_non_exited_threads (this, ptid).empty ()) + return; + if (!rs->supports_vCont.t) error (_("Remote server does not support stopping threads")); diff --git a/gdb/testsuite/gdb.server/interrupt-empty-remote-target.exp b/gdb/testsuite/gdb.server/interrupt-empty-remote-target.exp index 4facbe00533..4c959175433 100644 --- a/gdb/testsuite/gdb.server/interrupt-empty-remote-target.exp +++ b/gdb/testsuite/gdb.server/interrupt-empty-remote-target.exp @@ -14,7 +14,8 @@ # along with this program. If not, see . # Tests that GDB does not assert if interrupting an empty remote target -# in non-stop mode. +# in non-stop mode. Also tests that no 'vCont' package is sent for empty +# remote targets. load_lib gdbserver-support.exp @@ -32,3 +33,17 @@ gdb_test_no_output "set non-stop on" gdb_test "interrupt" \ "Cannot execute this command without a live selected thread." + +gdb_test_no_output "set debug remote on" + +# Test that we do not see a 'vCont' package if we interrupt an empty +# remote target. +set re \ + [multi_line \ + [string_to_regexp {[remote] stop: enter}] \ + [string_to_regexp {[remote] stop: exit}] \ + ""] + +gdb_test_lines "interrupt -a" "no vCont is sent" "^$re$" -re-not "vCont" + +gdb_test_no_output "set debug remote off" diff --git a/gdb/thread-iter.h b/gdb/thread-iter.h index c649560c0e1..b2a8a7f578d 100644 --- a/gdb/thread-iter.h +++ b/gdb/thread-iter.h @@ -248,6 +248,9 @@ class all_non_exited_threads_range all_non_exited_threads_iterator end () const { return all_non_exited_threads_iterator (); } + bool empty () const + { return begin () == end (); } + private: process_stratum_target *m_filter_target; ptid_t m_filter_ptid; -- 2.43.0 ________________________________________ Intel Deutschland GmbH Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany Tel: +49 (89) 99143-0 www.intel.de Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman Chairperson of the Supervisory Board: Sonja Pierer Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.