From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ocAPA+L7cmpGIgkAWB0awg (envelope-from ) for ; Wed, 05 Aug 2026 05:01:22 -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=I0TmPS7g; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 048C41E166; Wed, 05 Aug 2026 05:01:22 -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 D6AF21E033 for ; Wed, 05 Aug 2026 05:01:20 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7C6394BA5436 for ; Wed, 5 Aug 2026 09:01:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7C6394BA5436 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=I0TmPS7g Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by sourceware.org (Postfix) with ESMTPS id 0670D4B99F4A for ; Wed, 5 Aug 2026 08:59:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0670D4B99F4A 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 0670D4B99F4A 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=1785920382; cv=none; b=D665rOScNnL4F8DiD1D6I33MbPWTRrK1gWDq3zUqSIZJ2zlILBlKn1ZJtEhoeLxFosiKIGSbNW+nibkxSGNcdqjjQ+8FCLQeM/Kdp3Ts7PTOxuxV1WCqBY+Kz5wjnjW+Eastnwhd6KrB7KSU481tug/yCIF6E+27ZU1gtmwCZMA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1785920382; c=relaxed/simple; bh=2eruB6RZHeiyLTQJMpu9N6dR0ehsesGZUeXqMop23Yc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vVcoOIL7xZrdGpEVzOXZDhJOrpk9OVHb8MXYTz0SNRyVaW/zjPjkbdr7YcmOgrsIBt/PTUk4rbuDPrI3lsyV7TNgdBdv3Cnb403dzF8dCEZoLbX5bp7hEF3g+UsWWcLlLQZeKswD60dLLRetl5cp4AZ1p5EiMQYiKPpDwm+VQnk= 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=I0TmPS7g DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0670D4B99F4A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1785920383; x=1817456383; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=2eruB6RZHeiyLTQJMpu9N6dR0ehsesGZUeXqMop23Yc=; b=I0TmPS7gTJOLCXnPmxQ0f4B3Ok8veJ6E/1wu1RI7qjigNeGkqm+WoGIj JETcsiLwkkjRMeE2URbHaNfA1Ny/xEhhKIXNlx2NWgqoL/VpfgSrch7yN qKyxaWi+OJ82uMzRFCUJ4VCb3hqXvwRwxmFRP1wzJ9WNAN3sVgNF8+09z 53CcQrJl3LFkruZRbJ8NcZxxgFeAYSDXSBKgbxShx2cCFD9k8JAcRHW8E j4WzjcgmIbie4JAh41i0ynXjoALhnqOwKF5tpM3RrPPENUubY4qpijK5i GR0Fxm5Yq4so/0qnjb5ZSOxq0eIoO1guaoVQU0jVVUEv3Hbs3/ahc0ceU w==; X-CSE-ConnectionGUID: 9xYimlsUQO23y0xw7ML3ig== X-CSE-MsgGUID: MbnwowzyRUeASoWISDOuaQ== X-IronPort-AV: E=McAfee;i="6800,10657,11865"; a="90373378" X-IronPort-AV: E=Sophos;i="6.25,206,1779174000"; d="scan'208";a="90373378" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Aug 2026 01:59:42 -0700 X-CSE-ConnectionGUID: cutuGEhZTpmvFd83Xba2Dw== X-CSE-MsgGUID: 7kC2hXVbTh6vNmwOHRMXSQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,206,1779174000"; d="scan'208";a="299969351" Received: from dut1048pvc.igk.intel.com (HELO localhost) ([10.211.177.228]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Aug 2026 01:59:41 -0700 From: Stephan Rohr To: gdb-patches@sourceware.org Subject: [PATCH 2/2] gdb, remote: Skip sending of 'vCont' package if remote target is empty Date: Wed, 5 Aug 2026 08:59:18 +0000 Message-ID: <20260805085919.218925-3-stephan.rohr@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260805085919.218925-1-stephan.rohr@intel.com> References: <20260805085919.218925-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 | 18 +++++++++++++++++- gdb/thread-iter.h | 3 +++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/gdb/remote.c b/gdb/remote.c index 194c4cbd9bb..8be552b4533 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -7884,6 +7884,10 @@ remote_target::remote_stop_ns (ptid_t ptid) } } + /* Skip 'vCont' package 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 34437a17d90..c26b535be16 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 @@ -38,3 +39,18 @@ 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. +gdb_test_multiple "interrupt -a" "no vCont is sent" { + -re -wrap "vCont.*" { + fail $gdb_test_name + } + -re -wrap "" { + pass $gdb_test_name + } +} + +gdb_test_no_output "set debug remote off" diff --git a/gdb/thread-iter.h b/gdb/thread-iter.h index c649560c0e1..cc2b04e7e99 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 () + { 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.