From patchwork Mon May 18 18:32:57 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bouhaouel, Mohamed" X-Patchwork-Id: 135220 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 879EF4BA9017 for ; Mon, 18 May 2026 18:34:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 879EF4BA9017 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=Iv3j4N5y X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by sourceware.org (Postfix) with ESMTPS id 632A64BB24E7 for ; Mon, 18 May 2026 18:33:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 632A64BB24E7 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 632A64BB24E7 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129227; cv=none; b=VFWOiQS+8a/7TZwMlcD8k2pKiY64ZIt2HxyJoNu8BwPO8H4kOtlvct0JKAzgIKRYIqcJ6hX6ILlSiSyGMW1nmDegiO747iUr5sPWwcj7fUQ2w/3acW7mtkbsfJiQQmTaZQmAXEdxOPDZRx7npyxR+GgGZzUVNdzGT3D8vlCtz+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129227; c=relaxed/simple; bh=jD2cv5T94J42ZDOgOBAIJky+qT92Ovt5QMu9ui2zqfg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ZYWPXZ5LgPLLLoj30pIKqc73+RhdAKQojNEZapYHcqQ4vK30315eeBkgUZxxa+A4Wh6YMnlD7a3g8ed/CABcO1J1DQ2Ix/ovMEUZLQS+Fm8MT/4t+Bk+hP+typ5gA1NNLpyOaJQLrWKmS1UrSES9x97sZ/doHsm5ECA9CKOJwfk= 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=Iv3j4N5y DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 632A64BB24E7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1779129227; x=1810665227; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jD2cv5T94J42ZDOgOBAIJky+qT92Ovt5QMu9ui2zqfg=; b=Iv3j4N5ykJ3Xb4BssS2RRZ++QagMad3faAFzdkvTfGCobN70YquvD0cj xb5tR29+yLqNt0+tRq3HKQD0xZ+wLo4agC6+Wk0UobpiYM7hbDMLVFufT 01yrsEuIb8ZEBq1x7qkwvq0aYfK2yolFo1bla30Ea2TTjZ5iaahMMrG98 7gyk3wQHGIiOg9j5uHJtjwFCIj86FRcqHx0fTHvJC8JfpHM73JU24DU4v gmTuFSUbWh/F1o5443eVpM7C8SITEIJrS6sXk3lWqsNqbZQdCa5Qfj0ef fHfceU4jUNBBg17BHPzBP3uUZ5EZiHfh8B7fCESWEyThca6/qHiXOuBf7 Q==; X-CSE-ConnectionGUID: fJO0lTkgSZ6fYT90YEcABw== X-CSE-MsgGUID: 5A3lgmQjQa2JfmPcrCKzzQ== X-IronPort-AV: E=McAfee;i="6800,10657,11790"; a="83849752" X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="83849752" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:33:47 -0700 X-CSE-ConnectionGUID: NwG383t0R1iI7nlxJSnvVQ== X-CSE-MsgGUID: UQiT7hUkSsKipkJ/sG+ZCw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="238681073" Received: from cwhite-mobl.ger.corp.intel.com (HELO localhost) ([10.245.114.180]) by orviesa010-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:33:45 -0700 From: Mohamed Bouhaouel To: gdb-patches@sourceware.org Cc: mohamed.bouhaouel@intel.com, stephan.rohr@intel.com, markus.t.metzger@intel.com Subject: [PATCH 01/11] gdb, record: fix assertion when remote target is set to non-stop Date: Mon, 18 May 2026 20:32:57 +0200 Message-ID: <20260518183316.127043-2-mohamed.bouhaouel@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> References: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org 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~patchwork=sourceware.org@sourceware.org From: Markus Metzger When forcing the remote target to non-stop via 'maint set target-non-stop on', reverse tests start failing with (gdb) .../gdb/remote.c:7561: internal-error: resume: Assertion `scope_ptid == inferior_ptid' failed. This is caused by the record-full target doing one additional step after receiving a single-step trap event. That additional step is done on the wait ptid instead of on the event ptid. Fix it. --- gdb/record-full.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdb/record-full.c b/gdb/record-full.c index 69d2c100e57..fbb45c84931 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -1290,7 +1290,8 @@ record_full_wait_1 (struct target_ops *ops, "Process record: record_full_wait " "issuing one more step in the " "target beneath\n"); - ops->beneath ()->resume (ptid, step, GDB_SIGNAL_0); + ops->beneath ()->resume (inferior_ptid, step, + GDB_SIGNAL_0); proc_target->commit_resumed_state = true; proc_target->commit_resumed (); proc_target->commit_resumed_state = false; From patchwork Mon May 18 18:32:58 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bouhaouel, Mohamed" X-Patchwork-Id: 135221 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1F12D4BB24E2 for ; Mon, 18 May 2026 18:35:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F12D4BB24E2 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=fsK3I8gm X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by sourceware.org (Postfix) with ESMTPS id A11194BB24FD for ; Mon, 18 May 2026 18:34:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A11194BB24FD 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 A11194BB24FD Authentication-Results: sourceware.org; arc=none smtp.remote-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129241; cv=none; b=Qp4/l/K8Guh9SaVIJcMxZ46XHTnF+J9ay6d6Y7Llz8e7GA/OcAReiKIVxE8T0pLTZfZpXl/iPtrJqfksQpV1Jbc0NH6QiNMrXxZ99xB44q9cdRhiDf15hchxON3lhH4RVvWne1MHf2KZbwrKYfqlxBxMuZk0LAUPd5P7DSrFAB8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129241; c=relaxed/simple; bh=Pd75aqUJ7IgVuJI3B9msC8eUB1wHCofrizTn7zFWTSU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ofNeGZ0/02dgo57UTKp/T4+ugL/YP6kUkrj54eLhh4sQH+Ogucyf8uroMuuL9q29DFkuxhUnCSE6H8qTxkSusPzodEJlkN1O32qw23rQ729Ccgl7rQ+QRKVMldYFsWsiEpxo7R15vudR/Zt2iltuoImzzaX+TtVV3aDL/KZM9Wo= 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=fsK3I8gm DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A11194BB24FD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1779129242; x=1810665242; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Pd75aqUJ7IgVuJI3B9msC8eUB1wHCofrizTn7zFWTSU=; b=fsK3I8gmeBSpd70JkJbrNe9O5MBCtvAStrvhxC5UYR6ktwabklaAIrGL bh04J89mICDV3Bl9J1lib5YbosuRs910XNTglatZt/bc7yWLmquXQ0I+f F3DQcb0484Gmvn+TD00qKqoZD9T28snw1oJFjSRuIQyVySO6RyPPfwQo+ yR4dBIphAUNbz+k+htN8a2MeKZoYuYydIJbkISnK3j6UjQEBgVXT8ul1W VqpDGst85BakOhRpN+0g5tc/dWrwzW58DXVQQFrRXzfgKXxKjj9WwWDyz HJsXu5CdsOgWHjuvNoLoZHliHIdUPFY2Xb4VW7V3yCuzuICvmF15C3YNd Q==; X-CSE-ConnectionGUID: KAfN7nsERb6nfUugo1qb+g== X-CSE-MsgGUID: VUJqSQjVRXWAGawgwNAbjQ== X-IronPort-AV: E=McAfee;i="6800,10657,11790"; a="90576634" X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="90576634" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:34:01 -0700 X-CSE-ConnectionGUID: rq8cqb/wRiSeXc+mdZd1wA== X-CSE-MsgGUID: RtuJv2LCRJGrnJZeArH1AA== X-ExtLoop1: 1 Received: from cwhite-mobl.ger.corp.intel.com (HELO localhost) ([10.245.114.180]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:33:59 -0700 From: Mohamed Bouhaouel To: gdb-patches@sourceware.org Cc: mohamed.bouhaouel@intel.com, stephan.rohr@intel.com, markus.t.metzger@intel.com Subject: [PATCH 02/11] gdb, remote: fix assertion on reconnect to non-stop target Date: Mon, 18 May 2026 20:32:58 +0200 Message-ID: <20260518183316.127043-3-mohamed.bouhaouel@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> References: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org 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~patchwork=sourceware.org@sourceware.org From: "Bouhaouel, Mohamed" When reconnecting to a non-stop remote target, threads may retain stale internal state from the previous connection (e.g., THREAD_INT_RUNNING). This causes an assertion failure in thread_info::set_pending_waitstatus(), which requires the thread to be in THREAD_INT_STOPPED or THREAD_INT_RESUMED_PENDING_STATUS state. Fix by setting thread's states before calling set_pending_waitstatus () in process_initial_stop_replies (). Scenario: - Connect to non-stop remote target with running threads. - Disconnect (threads remain in THREAD_INT_RUNNING state). - Reconnect to same target. - process_initial_stop_replies() processes stop events. - Assertion fails when trying to set pending waitstatus on thread still marked as THREAD_INT_RUNNING. --- gdb/remote.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gdb/remote.c b/gdb/remote.c index 735774903f3..4bdbf4aeb08 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -5237,12 +5237,13 @@ remote_target::process_initial_stop_replies (int from_tty) ws.set_stopped (sig); } + set_internal_state (this, event_ptid, THREAD_INT_STOPPED); + set_state (this, event_ptid, THREAD_STOPPED); + if (ws.kind () != TARGET_WAITKIND_STOPPED || ws.sig () != GDB_SIGNAL_0) evthread->set_pending_waitstatus (ws); - set_internal_state (this, event_ptid, THREAD_INT_STOPPED); - set_state (this, event_ptid, THREAD_STOPPED); get_remote_thread_info (evthread)->set_not_resumed (); } From patchwork Mon May 18 18:32:59 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bouhaouel, Mohamed" X-Patchwork-Id: 135219 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A4BA44BB24EA for ; Mon, 18 May 2026 18:34:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A4BA44BB24EA 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=kc9yM1I1 X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by sourceware.org (Postfix) with ESMTPS id 322504BABF3D for ; Mon, 18 May 2026 18:34:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 322504BABF3D 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 322504BABF3D Authentication-Results: sourceware.org; arc=none smtp.remote-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129254; cv=none; b=mzgZfOHCgdzb2JHbQTO0ND88T1hGEQd8gbvvGXPSL9Jfkmugm50K9ZIk+kQLbQ7s3tTnuhDi8UGQgNUIs+KKjgrBLhx2n2FvVYAoW3soQilA9Jmz7C2q8eLP+2depKYJPqGj5Ppb2fbergoIvsLgxmEJTRBDbhm3vqorpHk7AO0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129254; c=relaxed/simple; bh=wplRZ1nCFMHTxhWHEq7kCd69ZdKrfxgojBSus9ONedY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=VbJwXbX4E00Und1ksDurLwoa7W4lNSbfjEJpy652n8ECWqlMKNOsbgw0Wuo1tGPSpu47JBjtCXD1gE/nKOptOgWY2xVOq/o8U4/zaETmb0m6T5hyhpZyOtvdic+ehSANDRDf2Wk+zr2FKSeRnfcfcX8o9XIT37NOVD5b7i2iF6Y= 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=kc9yM1I1 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 322504BABF3D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1779129254; x=1810665254; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wplRZ1nCFMHTxhWHEq7kCd69ZdKrfxgojBSus9ONedY=; b=kc9yM1I1zVqN78MfzHk+xF6+guGs63gQklo35/HGnmeKihbaRPOlXFLG WZQZSqMYENlCjOnZb9XLyxWOlToVSRiMe07dtsK2oiSXC7Qu5qAZzBpZ/ IE04jwh2r5C1kqm68Fn1hhmjjDO+ClLhK+DFdQ0U2aeEkvcnZQInyNnws W4bszis3sDKj6UoJm0usKWfmvC82Dkvo4bCi7DzbigCFkU8bzEp9x4/+q c3pl+b2U44d/DG9Wz6UyzUoPMMp47rPWHD/xopU69nA7pT/F+PsJLj4Jy BhoE5XHjubxWX9d90TaAUnZ8ocdZ3ciAkoOcxvLuJv0v2aAU06C9hATkE g==; X-CSE-ConnectionGUID: OSj5dTT/R6Wwq9c/7n0bJw== X-CSE-MsgGUID: sO3UqstmRtG986L949LoSQ== X-IronPort-AV: E=McAfee;i="6800,10657,11790"; a="83849804" X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="83849804" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:34:13 -0700 X-CSE-ConnectionGUID: ahT+EBtXR/CvUtB98by7Lg== X-CSE-MsgGUID: PL1rfjKfQNur37C3bbHkdw== X-ExtLoop1: 1 Received: from cwhite-mobl.ger.corp.intel.com (HELO localhost) ([10.245.114.180]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:34:12 -0700 From: Mohamed Bouhaouel To: gdb-patches@sourceware.org Cc: mohamed.bouhaouel@intel.com, stephan.rohr@intel.com, markus.t.metzger@intel.com Subject: [PATCH 03/11] gdb, remote: fix async handler assertion on reconnect to non-stop target Date: Mon, 18 May 2026 20:32:59 +0200 Message-ID: <20260518183316.127043-4-mohamed.bouhaouel@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> References: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org 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~patchwork=sourceware.org@sourceware.org From: "Bouhaouel, Mohamed" When reconnecting to a non-stop remote target during process_initial_stop_replies (), the code attempts to mark an async event handler before async mode is enabled. This causes an assertion failure in remote_state::mark_async_event_handler (), which requires the serial connection to be in async mode (is_async_p () == true). Fix by changing the condition in queued_stop_reply () from target_can_async_p () to target_is_async_p (), matching the pattern used in push_stop_reply (). When async mode is later enabled, the event handler will be marked then. Scenario: - Connect to non-stop remote target. - Thread receives signal (e.g., SIGUSR1) and stops. - Disconnect and reconnect. - Assertion fails because mark_async_event_handler () requires is_async_p (). --- gdb/remote.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/remote.c b/gdb/remote.c index 4bdbf4aeb08..b7ccd72829b 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8385,7 +8385,7 @@ remote_target::queued_stop_reply (ptid_t ptid) remote_state *rs = get_remote_state (); stop_reply_up r = remote_notif_remove_queued_reply (ptid); - if (!rs->stop_reply_queue.empty () && target_can_async_p ()) + if (!rs->stop_reply_queue.empty () && target_is_async_p ()) { /* There's still at least an event left. */ rs->mark_async_event_handler (); From patchwork Mon May 18 18:33:00 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bouhaouel, Mohamed" X-Patchwork-Id: 135225 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9397A4BB3B86 for ; Mon, 18 May 2026 18:36:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9397A4BB3B86 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=N4p9WkZL X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) by sourceware.org (Postfix) with ESMTPS id 3A2564BB1C3A for ; Mon, 18 May 2026 18:34:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3A2564BB1C3A 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 3A2564BB1C3A Authentication-Results: sourceware.org; arc=none smtp.remote-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129265; cv=none; b=pQXh4qVH8tupdUKaZClaZ2S6yDSY03CMggsZNqaDew5lPaNl9jviPhk525gIfddhTHojVc5lcYoFLSrjEoaXPbTLTXGa2LL7wcyogXdx/D3jKYBcefzRGLSFxI6DQaYhLpju8/ZHdfxxUc3hEZ64td1BY08ay+1STaDv/t/U5wA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129265; c=relaxed/simple; bh=O4r0AoWWIoDS3JwERbeG2+ANJi2AyBHSRAE8JcYZ1tI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=pDtw1wCGFQOSEVePW8bO+wp1MgPmS0OOb19YIukCMYXWdD7NmGB+TB5bpQDUNg6OXLCkJmcuPwAu93JuOrHaSEZSLyBnS33SxmpHIiEz+hTHAJsmhTovWwk7w7OHHhN/2mf3NjWpV7G3wbIj6/8qC4j8qn/2sS40ZdXNH10bx6M= 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=N4p9WkZL DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3A2564BB1C3A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1779129266; x=1810665266; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=O4r0AoWWIoDS3JwERbeG2+ANJi2AyBHSRAE8JcYZ1tI=; b=N4p9WkZLlbQKPSn3qseG76riedHGf4N+K4x7ZoR1qTutY6ePXGzRLlpX PUzBSwkBSl4LzgbHqBjO5XjsX0Qr5hiTkAawb1fTy8Ms+crPJp5wceEk6 oIE702Fd9kEXOwURGNqpHLlrab8X3kaEUViGcOkuNEWRwKvK6+8MUjUMk XeVxX/6Yr2JjTM+HnqMPGOXVgPc8AGP7Q6wflitt5QWrU6G0VP8bTkMBi 7HAfUmIRWXSKQ5IRPdJSYZ6AikMwXHrUXXbb8VQXOp+7IGFBKLrYr6QeR K1leHGZoCqzIzfmwnw291V0MexBTlfdXw0ikYJnq0zn53hPp47rmRIec4 g==; X-CSE-ConnectionGUID: 0WNpUT3PRtSwxHcEb583dA== X-CSE-MsgGUID: 2AQfcxuqR6axM45+wHIoDg== X-IronPort-AV: E=McAfee;i="6800,10657,11790"; a="79893973" X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="79893973" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:34:25 -0700 X-CSE-ConnectionGUID: 8tquVQe1Qz6TeZPM0d72zw== X-CSE-MsgGUID: DFl1GivoRjO1tMYHeWHDJA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="244502773" Received: from cwhite-mobl.ger.corp.intel.com (HELO localhost) ([10.245.114.180]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:34:22 -0700 From: Mohamed Bouhaouel To: gdb-patches@sourceware.org Cc: mohamed.bouhaouel@intel.com, stephan.rohr@intel.com, markus.t.metzger@intel.com Subject: [PATCH 04/11] gdb, remote: fix "info program" after reconnect to non-stop target Date: Mon, 18 May 2026 20:33:00 +0200 Message-ID: <20260518183316.127043-5-mohamed.bouhaouel@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> References: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org 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~patchwork=sourceware.org@sourceware.org From: "Bouhaouel, Mohamed" After reconnecting to a non-stop remote target that has stopped threads, "info program" incorrectly reports "The program being debugged is not being run" instead of showing the stop information. This happens because the previous_thread global is not updated when processing initial stop replies. Fix by calling update_previous_thread () after set_last_target_status () in print_one_stopped_thread (). Scenario: - Connect to non-stop remote target - Thread receives signal (e.g., SIGUSR1) and stops - Disconnect and reconnect - "info program" reports "not being run" (FAIL) --- gdb/remote.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gdb/remote.c b/gdb/remote.c index b7ccd72829b..a73362a26ee 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -5165,6 +5165,7 @@ remote_target::print_one_stopped_thread (thread_info *thread) /* For "info program". */ set_last_target_status (this, thread->ptid, ws); + update_previous_thread (); if (ws.kind () == TARGET_WAITKIND_STOPPED) { From patchwork Mon May 18 18:33:01 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bouhaouel, Mohamed" X-Patchwork-Id: 135223 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2AD494BB3B8B for ; Mon, 18 May 2026 18:35:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2AD494BB3B8B 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=fhDLptZn X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by sourceware.org (Postfix) with ESMTPS id 457844BABF3D for ; Mon, 18 May 2026 18:34:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 457844BABF3D 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 457844BABF3D Authentication-Results: sourceware.org; arc=none smtp.remote-ip=192.198.163.15 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129289; cv=none; b=XRKXUHCmyBfsXb17dq8OWJg4Y+Q4dYppoUUL2ERvrXTkIxojo3IKrVrcWT46KfwCI0yo8w0twiu5krmLBvK9ro7vFU9xeTQLJ7KlKkQ0aK4SyjXGdIthEaiD/xkycwjnQaWElcKyKaMFfb1mqjqhAvR96ZH/uAPr0kyG/hqqfUo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129289; c=relaxed/simple; bh=C2L5+weIPh3efjjXZaQhVPwyUrVN21mkxaYZ8ribkSA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ZkITSUzycgoPm+bN3LdofxRPt5DcytEabLGlBOHJhpZigYCJ26dGkGV5oBI0+dt+QqiLXhR7tvEy4Pw/7os24gxHUHAlmf7f0GuszzBbkvQddbZvGPSrSkQ3ummfzrJMv8HZXUbDofaelkuukCwwrR2rXpmlrsvSgsuvG4VTXYk= 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=fhDLptZn DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 457844BABF3D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1779129284; x=1810665284; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=C2L5+weIPh3efjjXZaQhVPwyUrVN21mkxaYZ8ribkSA=; b=fhDLptZnhzwA5vd41bIm/aL7lEFulyCTShU3HdWjJ7K6QgdHfvDEkpgy cs0A+/K37ukxpKojnX5yfhWJHwjent7H6m0vyW2OWSqVRhA4j9PVNJZwJ kzEl4uYIs8mE27EvZT1YeNvH+92gcIVmIdkVa5xvuI/4/8tglswv83pxP xYM8tnzVkGfCGe+PVmaG4kY9B2OzRqey9qBE+Gx7aCKe852ljx46WwR9Q oxFya1BP8SGo8JJ7hfP/63KMUmIf6CAmuCZSc5LYaP2zzpaGDhAxhLBlM PADtMLkg2g7alv3mQx6fWfOK8V+nKvdrL+1JztuHf+TjJsXp+yyOmpm7p Q==; X-CSE-ConnectionGUID: R6QymcxnSwaTCy07D+OJgA== X-CSE-MsgGUID: 36Cl10ZvSn2pK0YVjuleoQ== X-IronPort-AV: E=McAfee;i="6800,10657,11790"; a="80112162" X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="80112162" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:34:43 -0700 X-CSE-ConnectionGUID: T+8h8e75RFSniaeN40DCFw== X-CSE-MsgGUID: R/OXw0SeTf6ItAPvXLAW+g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="277619590" Received: from cwhite-mobl.ger.corp.intel.com (HELO localhost) ([10.245.114.180]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:34:42 -0700 From: Mohamed Bouhaouel To: gdb-patches@sourceware.org Cc: mohamed.bouhaouel@intel.com, stephan.rohr@intel.com, markus.t.metzger@intel.com Subject: [PATCH 05/11] gdb, remote: fix crash when accessing removed events Date: Mon, 18 May 2026 20:33:01 +0200 Message-ID: <20260518183316.127043-6-mohamed.bouhaouel@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> References: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org 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~patchwork=sourceware.org@sourceware.org From: "Bouhaouel, Mohamed" Dereferencing events after calling std::remove_if causes GDB to crash due to accessing invalidated iterators. Fix by logging events in std::remove_if. --- gdb/remote.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/gdb/remote.c b/gdb/remote.c index a73362a26ee..94ea4466c17 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8314,17 +8314,20 @@ remote_target::discard_pending_stop_replies (struct inferior *inf) /* Discard the stop replies we have already pulled with vStopped. */ - auto iter = std::remove_if (rs->stop_reply_queue.begin (), - rs->stop_reply_queue.end (), - [=] (const stop_reply_up &event) - { - return event->ptid.pid () == inf->pid; - }); - for (auto it = iter; it != rs->stop_reply_queue.end (); ++it) - remote_debug_printf - ("discarding queued stop reply: ptid: %s, ws: %s\n", - (*it)->ptid.to_string().c_str(), - (*it)->ws.to_string ().c_str ()); + auto iter + = std::remove_if (rs->stop_reply_queue.begin (), + rs->stop_reply_queue.end (), + [=] (const stop_reply_up &event) + { + if (event->ptid.pid () != inf->pid) + return false; + + remote_debug_printf + ("discarding queued stop reply: ptid: %s, ws: %s\n", + event->ptid.to_string ().c_str (), + event->ws.to_string ().c_str ()); + return true; + }); rs->stop_reply_queue.erase (iter, rs->stop_reply_queue.end ()); } From patchwork Mon May 18 18:33:02 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bouhaouel, Mohamed" X-Patchwork-Id: 135222 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EF6B14BB3B82 for ; Mon, 18 May 2026 18:35:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EF6B14BB3B82 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=K3zi2216 X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by sourceware.org (Postfix) with ESMTPS id A6EAE4BB24E1 for ; Mon, 18 May 2026 18:35:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A6EAE4BB24E1 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 A6EAE4BB24E1 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=192.198.163.15 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129307; cv=none; b=iTwPbBXxwJiCRCAlDma7jLZbyGUw1crSQy+govGY9MIwCSYLvWv29qWC2ZilpS5RVY7j2qc7zROQev+J2MPaPlwSHHmeA+zCGaRoegC0gi2zRKzCV58+PN6PApFKRT3rfmmLKAWnU5UQP9zmt4nAb4TFmCqCd/rockONhzxLQms= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129307; c=relaxed/simple; bh=rkVe70BV7EsCcU5ZkixZWryRXzQd5asotyDdy83FgSs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=WQH1RYfJVV9rnCcjwJTfb9vfMKsFett4B7rtMpMdCFJwVv3Q+uO3w/cx38Q0GwlsoyAHg7kglx4b8eSDahu4iB2D/zXZv8SNYb/UsEsOx/yTJdligLkD3IMUnMzzmDO8QShqOCnCuVh2sBg81mRCsUEaeO8S3rgONunttP1C45o= 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=K3zi2216 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A6EAE4BB24E1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1779129308; x=1810665308; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rkVe70BV7EsCcU5ZkixZWryRXzQd5asotyDdy83FgSs=; b=K3zi2216JQE/bYLnRDTusIEcEA4NUxwx01GtjN7XHhcp1amesGReCcey h3fxGNLu0/+XRQc6xR12IRTD69jcMN8CQcEYyKUyNAYJKPPIfifSwuFQk tnTxOiQr0xASpX8JJBEm2J81MJs2V33+GPreN3mPtEQTtK2F9q2dT70iy ZBEXjsLVQiALG7HXbe3e6LSzQNZ+unSZPSaUJ8vScqjNpO+tsEv0l0dJQ X0Z+WjyT/cigN8/agngjcwgtxhRY2FdV9BLh2wVVTq0rVLs91aEP753H4 xWJ+Ckgq/3op7q43NExxmAnhTp1LlGKHsbSR156SmcGdFbmr3vHdHT8eJ w==; X-CSE-ConnectionGUID: dNO5vmbnSDKLhqaXOtuNNQ== X-CSE-MsgGUID: +KkGvkVZToyaNj2EIqHljA== X-IronPort-AV: E=McAfee;i="6800,10657,11790"; a="80112189" X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="80112189" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:35:07 -0700 X-CSE-ConnectionGUID: EduFaReKT0q+s7gh9Ucanw== X-CSE-MsgGUID: zruPDrGqQHmX4VM2VdbZDg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="277619653" Received: from cwhite-mobl.ger.corp.intel.com (HELO localhost) ([10.245.114.180]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:35:05 -0700 From: Mohamed Bouhaouel To: gdb-patches@sourceware.org Cc: mohamed.bouhaouel@intel.com, stephan.rohr@intel.com, markus.t.metzger@intel.com Subject: [PATCH 06/11] gdb, remote: fix ptid matching for process-wide stop events Date: Mon, 18 May 2026 20:33:02 +0200 Message-ID: <20260518183316.127043-7-mohamed.bouhaouel@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> References: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org 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~patchwork=sourceware.org@sourceware.org From: "Rohr, Stephan" If an inferior call results in a process event for a non-stop remote target, GDB does not properly handle the event but is hanging. This reproduces with 'gdb.base/exit-in-condition.exp'. Because GDB is evaluating a breakpoint condition, the corresponding inferior call is evaluated w.r.t. the ptid of the current thread. gdbserver sends a process exit event; the event is not matched by the thread PTID and GDB hangs. Fix this by matching a process event in 'stop_reply_queue' if there is no matching thread event. This ensures a thread event is prioritized if both a thread event and a process event are queued and preserves the current behavior. --- gdb/remote.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gdb/remote.c b/gdb/remote.c index 94ea4466c17..92fe518c6de 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8363,6 +8363,20 @@ remote_target::remote_notif_remove_queued_reply (ptid_t ptid) { return event->ptid.matches (ptid); }); + + /* Match process events if PTID is a thread and there is no matching event + queued. Prioritize thread events to preserve the existing behavior. */ + if (iter == rs->stop_reply_queue.end () + && ptid != minus_one_ptid + && !ptid.is_pid ()) + iter = std::find_if (rs->stop_reply_queue.begin (), + rs->stop_reply_queue.end (), + [=] (const stop_reply_up &event) + { + return (event->ptid.is_pid () + && event->ptid.pid () == ptid.pid ()); + }); + stop_reply_up result; if (iter != rs->stop_reply_queue.end ()) { From patchwork Mon May 18 18:33:03 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bouhaouel, Mohamed" X-Patchwork-Id: 135224 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D0F9B4BB3BA6 for ; Mon, 18 May 2026 18:36:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D0F9B4BB3BA6 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=etW6XbL2 X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) by sourceware.org (Postfix) with ESMTPS id 93F1C4BB24FF for ; Mon, 18 May 2026 18:35:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 93F1C4BB24FF 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 93F1C4BB24FF Authentication-Results: sourceware.org; arc=none smtp.remote-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129328; cv=none; b=damiWx3i7JG8SoBpauNCkK7KoRuKfhrEnVP5LeMAVjW4AAw6KKip62LFO0q9r3RLDPaqQ9BdFIe77JeibOlXNuv569g8eBvtIXBqocFf8UEIPOWz+++LYtOiEHw4kAzc8f/PgXDXW8XMknC6EIan+9rIE8E7WQew1wjkhUDTRvI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129328; c=relaxed/simple; bh=oWOYd0kKe7EIzCd0gyVTPxxp6jWZsDeLx4il9KaF3wA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=EDfMRCccn1V66jeWuh7hdI/2WiDrFTdFabqjJH8FuPYU1JlLwXGJULBeG8/ZgcgyfnMQ7aFi8gQkF61UVTectIl4TN9LqmhwctMD7MPA7wLRwiTSoCCHAaYmOm8J4MZpCgM0ieOGCPwbCZxadgJjK67RQlY3ru3XkEuxYZ5hhQ8= 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=etW6XbL2 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 93F1C4BB24FF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1779129329; x=1810665329; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oWOYd0kKe7EIzCd0gyVTPxxp6jWZsDeLx4il9KaF3wA=; b=etW6XbL2I/fhqDm9SvQzD4cdRejPw+WpqvfZpr344qUqyV52jr5JdVxP 5vdpMZ+BYvXnBP7CirwdecQjCWHwv83q+DsXvT1mM3w7X5JhTXtmfixlt BJJToKAVtN18uySKB5eFYi2lv17rCP3Gk+SCKhK84cAy3035zk5ILuy8u 3SIHchZ7T+G1IEFRn6uDo6HsyXuXxpRvwcvwwUYpZdJ69BQ8aqQlef6yl cFiC937/yJsEzuFAHed0/dpPoe+pxPqgtYq5ykMVs4jnTmgrd9np0hPsa MLn2T1C33MNmRrzB3GKLejs234Y5jn79T34TeQ7Dg/UFM1fTbwy6pKEVY w==; X-CSE-ConnectionGUID: 4GTiOLqiTsql4pnHsns/PQ== X-CSE-MsgGUID: R535hLEWSpe/1OwMmpYHAQ== X-IronPort-AV: E=McAfee;i="6800,10657,11790"; a="90690463" X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="90690463" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:35:28 -0700 X-CSE-ConnectionGUID: WNEz1JFzRQ+pJkyB59GrOA== X-CSE-MsgGUID: VC7wZU8XQwC1D1XZQbH5ZA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="239584626" Received: from cwhite-mobl.ger.corp.intel.com (HELO localhost) ([10.245.114.180]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:35:26 -0700 From: Mohamed Bouhaouel To: gdb-patches@sourceware.org Cc: mohamed.bouhaouel@intel.com, stephan.rohr@intel.com, markus.t.metzger@intel.com Subject: [PATCH 07/11] gdb, dap: fix DAP events if no thread is selected Date: Mon, 18 May 2026 20:33:03 +0200 Message-ID: <20260518183316.127043-8-mohamed.bouhaouel@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> References: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org 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~patchwork=sourceware.org@sourceware.org From: "Rohr, Stephan" The DAP protocol requires a thread-id for a continue event. It is optional for the stopped event. If we force the remote target to run in non-stop mode, i.e., "-iex maint set target-non-stop on", GDB does not have a thread selected. Default to '0' for continue events in this case. Omit the 'threadID' for stopped events if no thread is selected. --- gdb/python/lib/gdb/dap/events.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/gdb/python/lib/gdb/dap/events.py b/gdb/python/lib/gdb/dap/events.py index 27e3b5ab8bc..85e672b4c9e 100644 --- a/gdb/python/lib/gdb/dap/events.py +++ b/gdb/python/lib/gdb/dap/events.py @@ -138,10 +138,14 @@ def _cont(event): log("_suppress_cont case") _suppress_cont = False else: + thread = gdb.selected_thread() + + # We may not have a selected thread if the target is running in + # non-stop mode. Default to '0' in this case. send_event( "continued", { - "threadId": gdb.selected_thread().global_num, + "threadId": thread.global_num if thread else 0, "allThreadsContinued": True, }, ) @@ -213,9 +217,11 @@ def _on_stop(event): if hasattr(event, "details"): log(" details: " + repr(event.details)) obj = { - "threadId": gdb.selected_thread().global_num, "allThreadsStopped": True, } + # The thread-id parameter is optional for stopped events. + if gdb.selected_thread(): + obj["threadId"] = gdb.selected_thread().global_num if isinstance(event, gdb.BreakpointEvent): obj["hitBreakpointIds"] = [x.number for x in event.breakpoints] if hasattr(event, "details") and "finish-value" in event.details: @@ -266,11 +272,14 @@ def _on_inferior_call(event): if not _infcall_was_running and inferior_running: inferior_running = False obj = { - "threadId": gdb.selected_thread().global_num, "allThreadsStopped": True, # DAP says any string is ok. "reason": "function call", } + # The thread-id parameter is optional for stopped events. + if gdb.selected_thread(): + obj["threadId"] = gdb.selected_thread().global_num + global _expected_pause _expected_pause = False send_event("stopped", obj) From patchwork Mon May 18 18:33:04 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bouhaouel, Mohamed" X-Patchwork-Id: 135228 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7B5EC4B99F61 for ; Mon, 18 May 2026 18:37:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B5EC4B99F61 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=iRf0wvuB X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by sourceware.org (Postfix) with ESMTPS id 4E0F74BABF3D for ; Mon, 18 May 2026 18:35:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4E0F74BABF3D 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 4E0F74BABF3D Authentication-Results: sourceware.org; arc=none smtp.remote-ip=192.198.163.15 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129338; cv=none; b=cemoyQg5sXDi3XGRv9VP8UA2KRBEpG18mhxe05Yb3UMSuWRzk6enSZygzQUpblGStuU9PplXfp0acr46B6wCoscnaaPYvKnBMpQLnomqZDqzioxC2z+D7OU+lIS3jDKJ3IW6+Ida8OfTS7pzyaHiPoasK4tFpImipKGPmbhzl38= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129338; c=relaxed/simple; bh=RNF4Haa8V2o2UARZ1ZA5J5a3QCWcSunLWcQkUWOaH+0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=N6emG8eDheg0KJ1P4QSCJG/nAqVkqdFtxOmtpSWSFKaLfjcrKMzTucrG5y+tctTkjr+uyI80AcSCj+iUC/FEeykCy8ZlNnXcw4h1bJ/kHhp1sVRM6D1NOao1suwIpItyZ464xBC2rNGaZIbYFi+LpiEqaWQeW1xAdbRnVit9Grw= 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=iRf0wvuB DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4E0F74BABF3D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1779129338; x=1810665338; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RNF4Haa8V2o2UARZ1ZA5J5a3QCWcSunLWcQkUWOaH+0=; b=iRf0wvuBWFp5yAb1PVnDZ+SPxfT4eQwfX7jdquUV4CxU53y7ZVRoQMnC IgDXLKw9J2FxWzaf0ALdjzSROFca/wLk31W0/+B14j7TRNzfIdVSu2qxb Fn2WvTWiUlfsd2f3f12zh/dhZQpt8qtJgyJfAFb/6qkpETbrGRnB25P+P lD7RsrtC0iAl8MQKvjwO+/uFgp9fbeZRnNBk2FctecK4BkftEjCZ6QQdo u1bktYbBWUTgrTEOEqb05v1J844LFA+wEIzAhOflzfPHXls6bcQdiaJ26 +d1zPrEYAU+KhX3T+aWWkYIZf8kk5doSoZgiVcwBfSK57FF/G96xU6q8u A==; X-CSE-ConnectionGUID: fT750J0GRke0htEPF/DHNQ== X-CSE-MsgGUID: hGddaB3URZm/azF3FhANWA== X-IronPort-AV: E=McAfee;i="6800,10657,11790"; a="80112259" X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="80112259" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:35:37 -0700 X-CSE-ConnectionGUID: cfDUeirdQNCrUS7SgpLxxA== X-CSE-MsgGUID: DXwiPJolSB6IBH//XGHF6g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="263290850" Received: from cwhite-mobl.ger.corp.intel.com (HELO localhost) ([10.245.114.180]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:35:36 -0700 From: Mohamed Bouhaouel To: gdb-patches@sourceware.org Cc: mohamed.bouhaouel@intel.com, stephan.rohr@intel.com, markus.t.metzger@intel.com Subject: [PATCH 08/11] gdb, testsuite: handle async close in monitor-exit-quit.exp Date: Mon, 18 May 2026 20:33:04 +0200 Message-ID: <20260518183316.127043-9-mohamed.bouhaouel@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> References: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org 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~patchwork=sourceware.org@sourceware.org From: "Bouhaouel, Mohamed" With non-stop remote targets, the "Remote connection closed" notification arrives asynchronously after "monitor exit" and may appear while processing the quit command, causing test failures. Fix by using "with confirm off -- quit" and handling the async notification in the quit sequence. --- gdb/testsuite/gdb.server/monitor-exit-quit.exp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.server/monitor-exit-quit.exp b/gdb/testsuite/gdb.server/monitor-exit-quit.exp index cb90169ef0c..f0db907576e 100644 --- a/gdb/testsuite/gdb.server/monitor-exit-quit.exp +++ b/gdb/testsuite/gdb.server/monitor-exit-quit.exp @@ -50,11 +50,16 @@ set gdbserver_gdbport [lindex $res 1] gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport gdb_test_no_output "monitor exit" -gdb_test_no_output "set confirm off" set do_cleanup 1 -gdb_test_multiple "quit" "" { +gdb_test_multiple "with confirm off -- quit" "" { + -re -wrap "Remote connection closed.*" { + # With non-stop remote targets, the "Remote connection closed" + # notification is delivered asynchronously and may appear while + # processing the quit command. + exp_continue + } -re -wrap "" { fail "$gdb_test_name (prompt)" # Let default_gdb_exit do the cleanup. From patchwork Mon May 18 18:33:05 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bouhaouel, Mohamed" X-Patchwork-Id: 135227 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 362BE4BB24E3 for ; Mon, 18 May 2026 18:36:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 362BE4BB24E3 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=CYKyrtQI X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) by sourceware.org (Postfix) with ESMTPS id 86E2F4BABF3D for ; Mon, 18 May 2026 18:35:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 86E2F4BABF3D 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 86E2F4BABF3D Authentication-Results: sourceware.org; arc=none smtp.remote-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129356; cv=none; b=OhKALYRtVmGxiiPnPqBDJ30OqOtPZ61ECGbZFnFzcokmD0fEoO3CxnBvn4UiaTJ3Unvh92kGarJM+YXIfedJ6t6rBZRtpIzmck7PbKoiokbj7gqvIHNQr+vskMkZGqavmWJHkYgnT8sb3lmrb9v54jWg8ieKYxKb6Aak2Bwqk5s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129356; c=relaxed/simple; bh=VBOuO662BUnG380OoGAhS8YNSnw94+BMju6fl+eZFvc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ANUD2pCQvIlnd1XVymA7ClrYVhlxlTBnklJe92ZJi2HtIQKTt3JtN47M6q0xK5bSEdyUGhRE9yMPHGXNwhfDCKPBcUzID3+wnAgd33EAyYcrSmfz29yEjmInH+osXdziMDcAeufMGBgjPICVi58nfJfjSqfw6O1YK7mMvkwcElw= 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=CYKyrtQI DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 86E2F4BABF3D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1779129357; x=1810665357; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VBOuO662BUnG380OoGAhS8YNSnw94+BMju6fl+eZFvc=; b=CYKyrtQICd3SBqeCjCZ7QUBjBOZMYWf4eMslk6LH1g0YvEsNzk41uFfO ldF9Kq7EU4iFUSfrbK/6s0cLpDPSM5rXwO6qw4no6/R/obZ+rCymieB+0 vNPR3lvSGT5aujoiqD7AQruu7CLFQIou283X8SEuiPVbzPx1+Ojfc+IOe LKUOmCtrRTuCNe/s/jCveMo47OqeHCHBgCl1SSYUPdL/105Ih8zVrTuld g1jvEMDSmmKv4t1yp91SSY10d/qsjO5YKaPbxoAC3kg/e4lGKKLXJ/BWE Q3gnUJmerQythbgk5OOEYKHcBAe40eyN+xtg0MivKC/KoqL88RtWU9Axk A==; X-CSE-ConnectionGUID: DwmXjWZzThmT3StnsrFhyA== X-CSE-MsgGUID: 4vIqJZK+SPaH8zENBq12AA== X-IronPort-AV: E=McAfee;i="6800,10657,11790"; a="90690511" X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="90690511" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:35:56 -0700 X-CSE-ConnectionGUID: DbAJjnvZSFuQxlhdq8VTfQ== X-CSE-MsgGUID: k1oooPQfQJCMdYZvuQwr3w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="239584707" Received: from cwhite-mobl.ger.corp.intel.com (HELO localhost) ([10.245.114.180]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:35:54 -0700 From: Mohamed Bouhaouel To: gdb-patches@sourceware.org Cc: mohamed.bouhaouel@intel.com, stephan.rohr@intel.com, markus.t.metzger@intel.com Subject: [PATCH 09/11] gdb, testsuite: update attach-deleted-exec.exp to handle async messages Date: Mon, 18 May 2026 20:33:05 +0200 Message-ID: <20260518183316.127043-10-mohamed.bouhaouel@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> References: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, POISEN_SPAM_PILL, POISEN_SPAM_PILL_1, POISEN_SPAM_PILL_3, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org 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~patchwork=sourceware.org@sourceware.org From: "Bouhaouel, Mohamed" With non-stop targets, async thread notifications can appear between output lines during attach. Also, multiple "Reading symbols from" messages are printed, so we need to specifically match the /proc/ path to capture the correct filename. Output example on a non-stop remote target: (gdb) attach 33604 Attaching to process 33604 [New Thread 33604.33604 (id 1)] Reading symbols from /proc/33604/exe... Reading symbols from /lib/x86_64-linux-gnu/libc.so.6... Reading symbols from /usr/lib/debug/.build-id/8e/9fd827446c24067541ac5390e6f527fb5947bb.debug... Reading symbols from /lib64/ld-linux-x86-64.so.2... Reading symbols from /usr/lib/debug/.build-id/da/07864eb4c1b06504b8688d25d7e84759fe708d.debug... [Switching to Thread 33604.33604] 0x00007c9166eeca7a in __GI___clock_nanosleep ... --- .../gdb.base/attach-deleted-exec.exp | 59 +++++++++++-------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/gdb/testsuite/gdb.base/attach-deleted-exec.exp b/gdb/testsuite/gdb.base/attach-deleted-exec.exp index 61ee8647c9c..71b1788a283 100644 --- a/gdb/testsuite/gdb.base/attach-deleted-exec.exp +++ b/gdb/testsuite/gdb.base/attach-deleted-exec.exp @@ -45,26 +45,29 @@ clean_restart # Attach. GDB should spot that the executable is gone and fallback to # use /proc/PID/exe. -set test "attach to process with deleted executable" -set re \ - [multi_line \ - "Attaching to process $decimal" \ - "Reading symbols from (\[^\r\n\]+)[string_to_regexp ...]" \ - ".*"] -set filename "" -gdb_test_multiple "attach $testpid" $test { - -re -wrap $re { - set filename $expect_out(1,string) - pass $gdb_test_name +set attached_pid "no pid" +gdb_test_multiple "attach $testpid" "attach to process with deleted executable" { + -re "Attaching to process $decimal\r\n" { + exp_continue + } + -re "\\\[New Thread \[^\r\n\]+\\\]\r\n" { + # Non-stop targets may emit async thread notifications. + exp_continue + } + -re "Reading symbols from /proc/($decimal)/exe[string_to_regexp ...]" { + set attached_pid $expect_out(1,string) + exp_continue + } + -re "Reading symbols from (\[^\r\n\]+[string_to_regexp /.nfs]\[^\r\n\]*)[string_to_regexp ...]" { + unsupported $gdb_test_name + return + } + -re "Reading symbols from \[^\r\n\]+[string_to_regexp ...]\r\n" { + exp_continue + } + -re -wrap "" { + gdb_assert { $attached_pid == $testpid } $gdb_test_name } -} - -set test "filename /proc/PID/exe" -set re_nfs \[^\r\n\]+[string_to_regexp /.nfs]\[^\r\n\]+ -if { [regexp $re_nfs $filename] } { - unsupported $test -} else { - gdb_assert { [string equal $filename /proc/${testpid}/exe] } $test } # Restart GDB. @@ -99,12 +102,18 @@ if { [target_info gdb_protocol] == "extended-remote" } { verbose -log "APB: warning: No executable has been specified, and target executable $filename_re could not be found\\. Try using the \"file\" command\\." -gdb_test "attach $testpid" \ - [multi_line \ - "Attaching to process $decimal" \ - "warning: No executable has been specified, and target executable $filename_re could not be found\\. Try using the \"file\" command\\." \ - ".*"] \ - "attach to inferior" +gdb_test_multiple "attach $testpid" "attach to inferior" { + -re "Attaching to process $decimal\r\n" { + exp_continue + } + -re "\\\[New Thread \[^\r\n\]+\\\]\r\n" { + # Non-stop targets may emit async thread notifications. + exp_continue + } + -re -wrap "warning: No executable has been specified, and target executable $filename_re could not be found\\. Try using the \"file\" command\\..*" { + pass $gdb_test_name + } +} # Check GDB hasn't managed to load an executable. gdb_test "info inferior" \ From patchwork Mon May 18 18:33:06 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bouhaouel, Mohamed" X-Patchwork-Id: 135226 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CC7BD4BB3B9F for ; Mon, 18 May 2026 18:36:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CC7BD4BB3B9F 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=D98BZ1ai X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by sourceware.org (Postfix) with ESMTPS id CC76F4BB3B95 for ; Mon, 18 May 2026 18:36:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CC76F4BB3B95 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 CC76F4BB3B95 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129366; cv=none; b=d91e5Mgq2BoradleHCfx43z0V9yBWhhruBdk/QGjqJ6kydJ+zQwF1+ALEvbkoa6kFrSEUWqa/odzZVUWPT3tEE7kyivUWEuCcxXX+3FBpnyUl6UbIcvL5S+SbrlUnUTO9Ngp+bsGaDTrFoA7W9m+akfKEQDuz/eDG6nh5GzTW2w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129366; c=relaxed/simple; bh=E5SoV3R1F1MUzKu1kooiWmlE3WggJ/put2dkY1K158s=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=gVRRwwF9Drzts1cDka9sV9ZENnzKSj62fkXmJWKp2mdC9QgJbaC9vtJTn61KY1QGhJoOGqjJo6zUiwP3VW8pSovUNllnRoyyWL+9IbjXxgHdOaSoiPf0BDCPHg5CBFd5LlvPmKZGgFgarRcTVDFFPBRZ2fQpRCStKoCaf9kHz9E= 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=D98BZ1ai DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CC76F4BB3B95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1779129366; x=1810665366; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=E5SoV3R1F1MUzKu1kooiWmlE3WggJ/put2dkY1K158s=; b=D98BZ1aiWT7/XuWlq5NN7Gu82SFviS9VBTlPoO9lQOqO6xKFcnvrlsv4 Uhl6beruShuT6nZ+vBjXMUwGTYGARmr3eNRBt5nM2x3DxgHGpJs384hk3 lUd9K5hFtlhbg3+bB8JdbMsNJqJudlwSqZ409QY/T/0URwZKvS7xIiIQA 0k9JRe9/pXURPAPCaWSBxBCDuTUu7sUB6F/Q+mQpGqTYm4+8WmCJmZci+ thw+RIPM1hVX1YyUpHxfVhMx6A6P8zDpIJ/UkzIIH4Bx+9eZ7AuVLROQz WJqlUHdpvLaFphQMwE+D8iHz46TvcCs1b5zTgf3LBC3gaTbin0hE2AJRC g==; X-CSE-ConnectionGUID: acDXw+G/RIyYy94kN9gj2g== X-CSE-MsgGUID: CvGVUWKzTdGvb8mIEYScEg== X-IronPort-AV: E=McAfee;i="6800,10657,11790"; a="67522334" X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="67522334" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:36:05 -0700 X-CSE-ConnectionGUID: yl60f/HoTraLUl95XuF6Yg== X-CSE-MsgGUID: oA7cskAPScSzaCc3wUx4Ug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="235257801" Received: from cwhite-mobl.ger.corp.intel.com (HELO localhost) ([10.245.114.180]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:36:03 -0700 From: Mohamed Bouhaouel To: gdb-patches@sourceware.org Cc: mohamed.bouhaouel@intel.com, stephan.rohr@intel.com, markus.t.metzger@intel.com Subject: [PATCH 10/11] gdb, testsuite: add kfails for step-over-process-exit.exp Date: Mon, 18 May 2026 20:33:06 +0200 Message-ID: <20260518183316.127043-11-mohamed.bouhaouel@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> References: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org 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~patchwork=sourceware.org@sourceware.org From: "Bouhaouel, Mohamed" When running 'gdb.threads/step-over-process-exit.exp' against a remote target in non-stop mode, GDB fails with a "Remote communication error" and does not display the expected "[Inferior ... exited normally]" message. The test passes in all-stop mode but fails when target-non-stop is enabled. Mark the affected assertions as kfail referencing the bug report gdb/34142 until the underlying issue is resolved. --- gdb/testsuite/gdb.threads/step-over-process-exit.exp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gdb/testsuite/gdb.threads/step-over-process-exit.exp b/gdb/testsuite/gdb.threads/step-over-process-exit.exp index 6c98ebe3956..72d270c907a 100644 --- a/gdb/testsuite/gdb.threads/step-over-process-exit.exp +++ b/gdb/testsuite/gdb.threads/step-over-process-exit.exp @@ -35,6 +35,11 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthread} # thread, or "other" for the non-main thread. proc test {which} { + if {$which == "other"} { + # The failure from the first iteration prevents + # the second iteration to run. + setup_kfail "gdb/34142" "*-*-*" + } if {![runto_main]} { return -1 } @@ -48,6 +53,7 @@ proc test {which} { set target_non_stop [is_target_non_stop] + setup_kfail "gdb/34142" "*-*-*" gdb_test_multiple "next" "" { -re -wrap "$::inferior_exited_re normally\\\]" { pass $gdb_test_name From patchwork Mon May 18 18:33:07 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bouhaouel, Mohamed" X-Patchwork-Id: 135229 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EDA934BABF3D for ; Mon, 18 May 2026 18:37:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EDA934BABF3D 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=JUADaCZ/ X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by sourceware.org (Postfix) with ESMTPS id 8C80D4BB3B8E for ; Mon, 18 May 2026 18:36:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8C80D4BB3B8E 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 8C80D4BB3B8E Authentication-Results: sourceware.org; arc=none smtp.remote-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129376; cv=none; b=mSC0JTvqmZGRXq4W9tE5gAGoTyVJS64m0jmCRzxNFvcHAt4CDieR8RafKlODl/fdKxGsEA79/2E/Y6aken6cm3RIi7s1s3w17ms8QRshtKWdvwVvkuLOKsPA4tE/VVET5Zh11h24koGqSYlkgSC1QL1WznriXZiC6DGKTgCUq/k= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779129376; c=relaxed/simple; bh=lFuP9C89uyiXj82I4TZfV84LJvxdNe5DKFFCLOEoXgw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=AyqPG0M9FrNzJ0q14hf6ncAyOgGU0wSnyC5ZVDh/0LV61JGkrXWwzuZQ5n/ZkRkga0O2Qm0UmgD9aLThxYxK+DacXVOJbf8Zvs0F/xfwQmoeWNF4iE9lvQ3nAqJ2PhS9dOd6NhaLaZ2x33A/Gt07wWLg8KLRq0L5z9VMwFIaRIw= 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=JUADaCZ/ DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8C80D4BB3B8E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1779129377; x=1810665377; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lFuP9C89uyiXj82I4TZfV84LJvxdNe5DKFFCLOEoXgw=; b=JUADaCZ/Vx2+3EljJhohPoIQGx77R6ot7Ab1667yYYQFmPQcB0k7lo5m sFkjhodEPgEu/jsl0rgf0Ka0cKvnPGFR55H9z+QKJlivrnVejqTvCpnjV EDsn3OhffF8I0BRdNU2elFbDbtjFYQCB8Ec48n8j08LrKtOijHL+ywFjf p/wSwBFjzznn/XzhWxwKhH5kP6vbcLDKwi2KrSKOx0D/hyWsijVx88elK HRoX7YI2aaTNqZH1lV3VUXpIN0XxRjqQHFY3AMj2GGqRstzGLN/doxncl RmJULZhBSBIOFnQdObuulHeqNYYRi+X+kLt5qVxg/uj3X2PF/ga8uJpCV w==; X-CSE-ConnectionGUID: f0ipgtrUS2mOIdOGV8XXTw== X-CSE-MsgGUID: 7nBSAMAZRkGB/ZQbSao/wQ== X-IronPort-AV: E=McAfee;i="6800,10657,11790"; a="67522343" X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="67522343" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:36:16 -0700 X-CSE-ConnectionGUID: q4s89B9tRPyKdY055nFgbw== X-CSE-MsgGUID: yxcNkU7fRU2PkrYQNcqfOQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="235257830" Received: from cwhite-mobl.ger.corp.intel.com (HELO localhost) ([10.245.114.180]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 11:36:14 -0700 From: Mohamed Bouhaouel To: gdb-patches@sourceware.org Cc: mohamed.bouhaouel@intel.com, stephan.rohr@intel.com, markus.t.metzger@intel.com Subject: [PATCH 11/11] gdb, remote: implement always_non_stop_p for remote target Date: Mon, 18 May 2026 20:33:07 +0200 Message-ID: <20260518183316.127043-12-mohamed.bouhaouel@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> References: <20260518183316.127043-1-mohamed.bouhaouel@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org 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~patchwork=sourceware.org@sourceware.org From: "Bouhaouel, Mohamed" Enable remote targets to natively operate in non-stop mode when they announce QNonStop packet support. This changes the default setting of 'maint set target-non-stop auto' from 'off' to 'on' for remote targets, aligning with the Linux native target. --- gdb/remote.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gdb/remote.c b/gdb/remote.c index 92fe518c6de..ecddb9c587d 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -1442,6 +1442,8 @@ class remote_target : public process_stratum_target void check_binary_download (CORE_ADDR addr); + bool always_non_stop_p () override; + target_xfer_status remote_write_bytes_aux (const char *header, CORE_ADDR memaddr, const gdb_byte *myaddr, @@ -9877,6 +9879,16 @@ remote_target::check_binary_download (CORE_ADDR addr) } } +/* Determine whether the remote target natively operates in non-stop mode. + Returns true if the target announced QNonStop support for asynchronous + execution and stop notifications. */ + +bool +remote_target::always_non_stop_p () +{ + return m_features.packet_support (PACKET_QNonStop) == PACKET_ENABLE; +} + /* Helper function to resize the payload in order to try to get a good alignment. We try to write an amount of data such that the next write will start on an address aligned on REMOTE_ALIGN_WRITES. */