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 ();