From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id UZUfCv1bC2q97QUAWB0awg (envelope-from ) for ; Mon, 18 May 2026 14:35:41 -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=fsK3I8gm; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 26E121E024; Mon, 18 May 2026 14:35:41 -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 B36FE1E024 for ; Mon, 18 May 2026 14:35:40 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 59F3B4BB24E5 for ; Mon, 18 May 2026 18:35:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 59F3B4BB24E5 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 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 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, 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 (); } -- 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