From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id OYYjN2Gwo2pSKj8AWB0awg (envelope-from ) for ; Fri, 11 Sep 2026 03:40:17 -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=kxNsXyRp; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id DDFD51E091; Fri, 11 Sep 2026 03:40:17 -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 [IPv6:2620:52:6:3111::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 29CD51E091 for ; Fri, 11 Sep 2026 03:40:16 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5EF164902653 for ; Fri, 11 Sep 2026 07:40:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5EF164902653 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=kxNsXyRp Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by sourceware.org (Postfix) with ESMTPS id A010C48FBC90 for ; Fri, 11 Sep 2026 07:39:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A010C48FBC90 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 A010C48FBC90 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=1789112389; cv=none; b=JA08hm4lBq+0CudXuE0dAUVcS9zRgs15ECQYoJZMjxtB6t2x1qD+5z6YGB+84/5wOvW4W1Q1NgDxIPljY8TRmrmh7h83YCd75shp+N0sYgwFH3TcZ0xeh3QDEnfUaC4mvXtKR+yJto4AmLfI+9Nt4s3WCWzSR6D5Yam4A0YnyD4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789112389; c=relaxed/simple; bh=XXRNIiSipEqfFgcw3aL31zk+CP9XjwzDj9YNWLp6ovI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=jt/7axphwUweYvwVzOZTTwst72A1vknacjozoF3S/8MW/d7nz2S6w+ITOeE9IwoFvJY62MM7vgP4x21BIAaWr6DKJ48g0b15KCDyNRhwonT72wJuILiB1Hyy2M5Iq+VnSJwUOLp9J7I5ZhZdY0fnduoffCceFl9DRV8ukamYdK8= 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=kxNsXyRp DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A010C48FBC90 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1789112390; x=1820648390; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XXRNIiSipEqfFgcw3aL31zk+CP9XjwzDj9YNWLp6ovI=; b=kxNsXyRpjA1ae/Z6isj8zOKm1MLx1hTQYhUNJt+OmfAUTP4i4F2P9w6R KCh+oaVUYY5S81w+YYaKv1YesVGdZEYtYlAGdpdHPU6UmtJHBvLQs6trz Gtza24rA7v9be57Tt2abmHTz7qYIwxewhAO6tRJW1ZftZaYwwbEMlb1H3 yhxfF1dfi7SS1xdjl1D6SGrEebXjZA30MHxleNb8NWPgj2XgW7sFSlM69 gF5rW5lvmh7vJLhjkfwjliHhSCtIKxju3i0Fp3P9EsHW3sefSlPzR/TL6 DF+bqsP9M7VXjSqY/eiaQszUJ+dt+4MyLVo0towv/olB1mtgLy/AwpV7O w==; X-CSE-ConnectionGUID: kreheL8qTZyhEEmVH0gMfQ== X-CSE-MsgGUID: 7AELJe8hR364qAnj6gB+XQ== X-IronPort-AV: E=McAfee;i="6800,10657,11901"; a="93440508" X-IronPort-AV: E=Sophos;i="6.27,96,1787036400"; d="scan'208";a="93440508" 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:47 -0700 X-CSE-ConnectionGUID: 675dkfw7Q3CUsNzWZQ0ofQ== X-CSE-MsgGUID: ebxiDBNbSJ+LgnSrDaaNdg== 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:45 -0700 From: Stephan Rohr To: gdb-patches@sourceware.org Cc: tom@tromey.com Subject: [PATCH v3 1/2] gdb: fix assertion when interrupting an empty remote target Date: Fri, 11 Sep 2026 07:39:09 +0000 Message-ID: <20260911073910.17936-2-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" GDB asserts when sending an interrupt to an empty remote target, e.g. use stdio to connect to a remote target in non-stop mode: 'gdb -ex "set non-stop on" -ex "target extended-remote | gdbserver --multi --once -' Interrupting the target triggers an assertion in 'find_inferior_pid'. Fix by checking for a valid thread in 'interrupt_target_1' for 'non-stop' mode. --- gdb/infcmd.c | 5 ++- .../interrupt-empty-remote-target.exp | 34 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 gdb/testsuite/gdb.server/interrupt-empty-remote-target.exp diff --git a/gdb/infcmd.c b/gdb/infcmd.c index ed760583dd9..e5eea8996cb 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -3148,7 +3148,10 @@ interrupt_target_1 (bool all_threads) } } else - stop_current_target_threads_ns (inferior_ptid); + { + ensure_valid_thread (); + stop_current_target_threads_ns (inferior_ptid); + } } else target_interrupt (); diff --git a/gdb/testsuite/gdb.server/interrupt-empty-remote-target.exp b/gdb/testsuite/gdb.server/interrupt-empty-remote-target.exp new file mode 100644 index 00000000000..4facbe00533 --- /dev/null +++ b/gdb/testsuite/gdb.server/interrupt-empty-remote-target.exp @@ -0,0 +1,34 @@ +# Copyright 2026 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Tests that GDB does not assert if interrupting an empty remote target +# in non-stop mode. + +load_lib gdbserver-support.exp + +require allow_gdbserver_tests + +clean_restart + +# Make sure we're disconnected, in case we're testing with an +# extended-remote board, therefore already connected. +gdb_test "disconnect" ".*" + +gdbserver_start_extended "--once" + +gdb_test_no_output "set non-stop on" + +gdb_test "interrupt" \ + "Cannot execute this command without a live selected thread." -- 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.