From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 2aV1G5b7cmpGIgkAWB0awg (envelope-from ) for ; Wed, 05 Aug 2026 05:00:06 -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=howuqZsG; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 6C5471E166; Wed, 05 Aug 2026 05:00:06 -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 B4E9E1E033 for ; Wed, 05 Aug 2026 05:00:05 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4DD3C4BA799B for ; Wed, 5 Aug 2026 09:00:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4DD3C4BA799B 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=howuqZsG Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by sourceware.org (Postfix) with ESMTPS id E6EC94BAE7C0 for ; Wed, 5 Aug 2026 08:59:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E6EC94BAE7C0 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 E6EC94BAE7C0 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=1785920375; cv=none; b=dN8+iT/+4sacgL4LMLAJ6lFz4ywMRtUrEnys40snkFIQ5V1BYYhfrNdV/PHkTjGTyyCgjIx7y1IYAd1qUO+i9QA8zOOoM9nRvmUr2pSqWvHN+Y3h9OGDfCwAgjNIkjNgyfWy+pqGORTC1KIte07et1QNdnNZzvmQRziVqcOY1n8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1785920375; c=relaxed/simple; bh=WH2fwRgMFH4hxbzKulB3NNSTP4jwoD2hEAdXiNp0kwE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=jBkqArwjjyKGHvngIXV9CwTjIcrARY6aKH+K6qrQMKJbKy2IoVD9wST48EnpCoUilK61kAGZtkA2MzRU+A+SMjhQTCRRkvIj+fMjQ/xSmh5MzTRzPFjAHYidx13c/MGI90f3aKF4Y8MPrkzPe4FD/vakXGe+TjJ/3ZG+34WaWWU= 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=howuqZsG DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E6EC94BAE7C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1785920375; x=1817456375; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=WH2fwRgMFH4hxbzKulB3NNSTP4jwoD2hEAdXiNp0kwE=; b=howuqZsGLauSxg04PRHK/YFpoA3s568bJIcfKN8h95NE8vPXFFNCyfh0 MP1FaAdudAjeEEm0qStdjZX4owBjzeBAgVrovBsQiuJM/i2hMUfq9+sLA fIq87rjkGqGp7K2ovc60IlDjmDfRtsZP7JW90aYzXvFduu/z8BLToBNQn DVJ7bFz08zFG/SsklWUalZjlfYOxbh4hmqPkBysVrh7CZVJZWE9bZ2doH qsVQydjTg2Oa/7BjiW/D/7cUDJ1vBSWLP9yZUoZq9eDzpIouKnjyLg+Lw VQ/rlZHjeCyeDa81eIWen33zIZJZbKC44dTn86U+UEJwQH+XV2MR8W+iL A==; X-CSE-ConnectionGUID: k7lFvry1Tsm2IhUz37GdMg== X-CSE-MsgGUID: qJoyNHbTQSeCO8D8Pi7Kzg== X-IronPort-AV: E=McAfee;i="6800,10657,11865"; a="90373372" X-IronPort-AV: E=Sophos;i="6.25,206,1779174000"; d="scan'208";a="90373372" 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:35 -0700 X-CSE-ConnectionGUID: 7gGgBuKBRCK/DhyqGIsmpA== X-CSE-MsgGUID: n4wRivuXQWqNU100wXU75A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,206,1779174000"; d="scan'208";a="299969316" 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:34 -0700 From: Stephan Rohr To: gdb-patches@sourceware.org Subject: [PATCH 1/2] gdb: fix assertion when interrupting an empty remote target Date: Wed, 5 Aug 2026 08:59:17 +0000 Message-ID: <20260805085919.218925-2-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" 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 | 40 +++++++++++++++++++ 2 files changed, 44 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 3e943123519..512ecde4879 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -3133,7 +3133,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..34437a17d90 --- /dev/null +++ b/gdb/testsuite/gdb.server/interrupt-empty-remote-target.exp @@ -0,0 +1,40 @@ +# Copyright 2024 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 + +standard_testfile server.c + +if {[build_executable "failed to prepare" $testfile $srcfile debug]} { + return -1 +} + +clean_restart ${testfile} + +# 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.