From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ManjM7+vnmq+/zMAWB0awg (envelope-from ) for ; Mon, 07 Sep 2026 08:36:15 -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=YxD3BEQI; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id CFB451E091; Mon, 07 Sep 2026 08:36:15 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.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 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 BF28B1E091 for ; Mon, 07 Sep 2026 08:36:12 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 28A014B9DB5C for ; Mon, 7 Sep 2026 12:36:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 28A014B9DB5C 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=YxD3BEQI Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by sourceware.org (Postfix) with ESMTPS id 5D60E4C91759 for ; Mon, 7 Sep 2026 12:35:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5D60E4C91759 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 5D60E4C91759 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788784507; cv=none; b=Ashl4EA+xNnuvB8+PfCqh7Td2y8Gfk5mCuGLdRG7RxM7QL1XKgqns4E94qW94TkP7CAq2kCPhmRD7bl7XHmuEVGiduxEW8juXOSGv3u+BxDObtEL7J8VRoe9wvBrkIOPYMOvTbLDqGcD6os1mS+aF17CNEBSg3aOflQV1WLBzNM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788784507; c=relaxed/simple; bh=kIXjkZuc6YUOH8OhB/JxjS+E6p1V0KF5qnfZA5q36bg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=tnXalBvLt/t/miXTcbeBAwZz3KE1nFTFfgBWdbkLjNr0260A0SueRMseYY66l4t7X607/RboNP14tAXyEFeCcN2Jj2mRyrOIZddz9UqldEv4hhQvPKoagno4bd7t5yGOgqD7TiENDm6Sar6EmQDWJWA+y4EdC2mVlUZvsjzXzDk= 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=YxD3BEQI DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D60E4C91759 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1788784508; x=1820320508; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kIXjkZuc6YUOH8OhB/JxjS+E6p1V0KF5qnfZA5q36bg=; b=YxD3BEQI3gsH+HQKhSbWZ9t33g2mUgZu+Oykmf4dAH1EaeZg4stbq63m mZoryRqOf+0oStYV1x6j446S6DdRz4CXXT2YFwSLmYYVFjy4mMniN//vQ 1WRpMozz/4dZmysgCRHWpWLjqRLJ571JBtrn4L+HoR838eyAepAg64eRE PYZN9ZOu+0VODlKv8+qgl5YIaiFQPoLRJ0UBpVl6sZRvmbmdQPEESjs4+ xk1bf488c+7IvMqqTugBsBM3o3mOrAIDM0oLVrpU2gftwzZt5I3jldJo/ 83OAJbJkWGWyHAUohNNTQrvPTOYKdRBISkkMn0alz8omNVvIA4auuGerE A==; X-CSE-ConnectionGUID: m2+/qxTlQseTAVS60UzxyQ== X-CSE-MsgGUID: bQO7jQD7TfaLQb6CN4DI1w== X-IronPort-AV: E=McAfee;i="6800,10657,11898"; a="100542466" X-IronPort-AV: E=Sophos;i="6.25,267,1779174000"; d="scan'208";a="100542466" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2026 05:35:06 -0700 X-CSE-ConnectionGUID: a+9TN5+JS8K4DIAidDZKsQ== X-CSE-MsgGUID: udXef6S6QxaLI/AZ1V0yZA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,267,1779174000"; d="scan'208";a="294176436" Received: from dut1028pvc.igk.intel.com (HELO localhost) ([10.211.177.254]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2026 05:35:05 -0700 From: Stephan Rohr To: gdb-patches@sourceware.org Cc: tom@tromey.com Subject: [PATCH v2 2/2] gdb, remote: Skip sending of 'vCont' packet if remote target is empty Date: Mon, 7 Sep 2026 12:34:36 +0000 Message-ID: <20260907123436.99614-3-stephan.rohr@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260907123436.99614-1-stephan.rohr@intel.com> References: <20260907123436.99614-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..e8666a884e6 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 (); } + const bool empty () + { 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.