From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 8UYKHtqbS2pKvCkAWB0awg (envelope-from ) for ; Mon, 06 Jul 2026 08:13:14 -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=XQkEKmM4; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 76C2A1E070; Mon, 06 Jul 2026 08:13:14 -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 9A9731E070 for ; Mon, 06 Jul 2026 08:13:13 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DB5724BA2E3A for ; Mon, 6 Jul 2026 12:13:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DB5724BA2E3A 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=XQkEKmM4 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) by sourceware.org (Postfix) with ESMTPS id C180E4BA2E09 for ; Mon, 6 Jul 2026 12:12:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C180E4BA2E09 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 C180E4BA2E09 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=1783339963; cv=none; b=ZiFt1Jp5BLrNyRISABV/ROlrLXZDGL8i+JnogY6Q99CT2T9xwX2JZjjDtdHB+xSDelaD2eoRerOwXNQImMyWELjlIeXWenLAepX80hC2OFlwRq4qTv0r77Td/Moz2xGk5EmXSz1yiy/DUirHb94eHUh+EvhDNRj2aRFhM7656Wc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783339963; c=relaxed/simple; bh=zvQo42DF9R1f4z5uJ+9jsMQqnMF7vlTq0uwxEbeQGAo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ntXWxyIWvWT099BMlCVUJqMM7qvzX8pzw/Qap6tMxs53nGaj2h0qeHiT7zE/C2kTfTWPBrlvEowzi+Qjl/TIcqAYxzqRFrkMEpZWluSOS2B/rZvQ0+pAqRWXXhVoM0pQckuLPTJ+fkuUKGveRH4hDram5JYMLWAqBg6ZoR3VTj8= 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=XQkEKmM4 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C180E4BA2E09 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1783339963; x=1814875963; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zvQo42DF9R1f4z5uJ+9jsMQqnMF7vlTq0uwxEbeQGAo=; b=XQkEKmM4q1VH86FSbGxoUrneYieikIrdI49+XyCxk97p5qguRdRWv1BT vtCuPxnnnbhdWoLS6dPfAeEVr7P0ODTvMXEtrBrxO0BPRoq+lLxI5lG95 Rkv1F2j18q/lEx7Np5+7KQOwwEBe5f743/CJmP/M/O4GtO5KSaAwNb7Sl uOhQRr0VgPwN4tpZB7t/6h9shB6HcyfoJjshv1jdveM25qGjT3HjKXkvw ZXV5DRdX2kb3bx8FdxsT3iKFs9YeAmnbRzmshYdtbIRvvKI7WEPKgRvFr 3zHWrnXhq5dpCm2zAXHB5uo1plRgUW67+/p00XjoTkl6euZVc00GVdy6T Q==; X-CSE-ConnectionGUID: YsY4yeCuRuGbgYb8WKmf1A== X-CSE-MsgGUID: 7pMJDRBtQxWTaDvO9xXFyQ== X-IronPort-AV: E=McAfee;i="6800,10657,11838"; a="83834539" X-IronPort-AV: E=Sophos;i="6.25,149,1779174000"; d="scan'208";a="83834539" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2026 05:12:42 -0700 X-CSE-ConnectionGUID: b6tXx8RbRLS8IL05lWBzFw== X-CSE-MsgGUID: 6YQdzY74TRGFncjf9e/HGQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,149,1779174000"; d="scan'208";a="255637939" Received: from unknown (HELO localhost) ([10.245.114.180]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2026 05:12:40 -0700 From: Mohamed Bouhaouel To: gdb-patches@sourceware.org Cc: stephan.rohr@intel.com, markus.t.metzger@intel.com, pedro@palves.net, aburgess@redhat.com Subject: [PATCH v3 03/11] gdb, remote: fix async handler assertion on reconnect to non-stop target Date: Mon, 6 Jul 2026 14:11:16 +0200 Message-ID: <20260706121124.18784-4-mohamed.bouhaouel@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260706121124.18784-1-mohamed.bouhaouel@intel.com> References: <20260706121124.18784-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 caf0579e94e..646af2ffca6 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8325,7 +8325,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