From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id gcqrLP3VKmqOswEAWB0awg (envelope-from ) for ; Thu, 11 Jun 2026 11:36:29 -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=M4Xa9Lyq; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B2CE91E070; Thu, 11 Jun 2026 11:36:29 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.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,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED 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 B58011E070 for ; Thu, 11 Jun 2026 11:36:28 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 517904B99F57 for ; Thu, 11 Jun 2026 15:36:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 517904B99F57 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=M4Xa9Lyq Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by sourceware.org (Postfix) with ESMTPS id 515C54BA2E17 for ; Thu, 11 Jun 2026 15:34:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 515C54BA2E17 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=tempfail smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 515C54BA2E17 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781192057; cv=none; b=p4yuVn3i3dsLTKIEkZyA6uQoQyGJr62GJcR4VtrCY1DFiYnexClnMdVQBtCFLMuLIVFpUk+7rZkvtVdY/5cdVnsFx+r0KvqVBaArIV3NVC7zewNH21wEVbmBy1JobaRrtStoqgLNPaGXI1B+rBjZL4VDfBcSm1GVmMfvJQAQBQA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781192057; c=relaxed/simple; bh=fvZFKSz3+dpmkCSw0mVRIi9EywfjHueMc6Qzr4kwpOQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=B/O1ND/UMj+J8TKvDrUc9SvsGA6edSri/gYQKNXuyd0ubjELhHGrjk1UXqKhJ7olnZqY3GyUhXOgC0pFbThMdgyHoWGoloMdpaJMj0lkG2a8mQXIFtIKKZHPQXSleMf/ON4SL6tq4qolbnPFbvM7vgjaiq6yHjVgfgYlOnGLcPs= 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=M4Xa9Lyq DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 515C54BA2E17 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1781192052; x=1812728052; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fvZFKSz3+dpmkCSw0mVRIi9EywfjHueMc6Qzr4kwpOQ=; b=M4Xa9LyqhDy3AyXkX18ElfmEITUrUxHuiWhkNb1g3pQ/nbSXGoRfKtE0 VRacDO1H6pLSgXInii97MP9lF8UZemQw20seI4tXpZrcN2qv8+xHTH97W Pg41iNBXjPjtV+aO2/1dfTRbkbNJ4XOW8IfrW6MOEjwrtw22FkoZaqK2W ADu1hH5A9+hTHCI+aiMUpj5EzOvz1+5KaAq55ulgu4T2SYf1xEs0UrXWz fQpvqi4BOtta8SSD5Pu/X7NyHlo53HY4osHb6fFkEYBSNDSbl1RoxXdgZ GbdX9374PoDme4vsmbMrR1nDknFVgyMAyr9O5SIb2uTx1fSHWaTqLyS9M w==; X-CSE-ConnectionGUID: cbqrr4KVQn6nNtiAzxULLQ== X-CSE-MsgGUID: fe6jwJElRLemFOFcfAwMyQ== X-IronPort-AV: E=McAfee;i="6800,10657,11813"; a="99430897" X-IronPort-AV: E=Sophos;i="6.24,199,1774335600"; d="scan'208";a="99430897" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2026 08:34:11 -0700 X-CSE-ConnectionGUID: SZEYOExXQfWrUy/L0ycqvw== X-CSE-MsgGUID: ioR5oQ2DSuCe/IirWMJt1w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,199,1774335600"; d="scan'208";a="244071156" Received: from womilian-mobl.ger.corp.intel.com (HELO localhost) ([10.245.82.28]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2026 08:34:09 -0700 From: Mohamed Bouhaouel To: gdb-patches@sourceware.org Cc: markus.t.metzger@intel.com, stephan.rohr@intel.com, aburgess@redhat.com, mohamed.bouhaouel@intel.com Subject: [PATCH v2 03/11] gdb, remote: fix async handler assertion on reconnect to non-stop target Date: Thu, 11 Jun 2026 17:32:23 +0200 Message-ID: <20260611153232.3011-4-mohamed.bouhaouel@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260611153232.3011-1-mohamed.bouhaouel@intel.com> References: <20260611153232.3011-1-mohamed.bouhaouel@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: "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 (). Reproducible when running gdb.threads/reconnect-signal.exp, on native-gdbserver or native-extended-gdbserver with target-non-stop enabled. export GDBFLAGS="-iex \"maint set target-non-stop on\"" make check TESTS="gdb.threads/reconnect-signal.exp" \ RUNTESTFLAGS="--target_board=native-gdbserver GDBFLAGS='$GDBFLAGS'" --- gdb/remote.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/remote.c b/gdb/remote.c index ab6fa8d3490..d08d52ecfe1 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 (); -- 2.43.0 Intel Deutschland GmbH Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany Tel: +49 89 991 430, www.intel.de Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell Chairperson of the Supervisory Board: Nicole Lau Registered Seat: Munich Commercial Register: Amtsgericht Muenchen HRB 186928