From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id gWnGBDg2vmrsLCMAWB0awg (envelope-from ) for ; Thu, 01 Oct 2026 06:30:16 -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=elwoaz2z; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 0C1AA1E033; Thu, 01 Oct 2026 06:30:16 -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 17BD61E033 for ; Thu, 01 Oct 2026 06:30:15 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6942E4BB590E for ; Thu, 1 Oct 2026 10:30:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6942E4BB590E 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=elwoaz2z Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by sourceware.org (Postfix) with ESMTPS id 7BE0B4BB58F4 for ; Thu, 1 Oct 2026 10:28:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7BE0B4BB58F4 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 7BE0B4BB58F4 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=192.198.163.14 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790850536; cv=none; b=uNd4qTcfElg/1MzNlOyIxeF6BT4FCPOWBAuxb3HgqHPLpdwFmgp/ObJo5E0q0GrJ/zqgnJYkaj3qgjhI7XepsNfaV/rji80FbcG45MoxvDZ7S5P2QGg64Qjq+SStw7vfHpei8CFSWwSOyPoyvAx7yBoCN5BZDBbQu40R/RrbPTA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790850536; c=relaxed/simple; bh=c0ekZJfbryX0WnRpmK9zKx/3yPKPColdhbYN8rAA/O4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vjElze4jty1hayPnWbwivZPdNKcaFtf7NAAZWoqBDvtkCLYLwPO/de/rifd10oLd+HvsCgGTtnn5NfF7pVStc5RcwGF4MGz8SLzzMn3EQe3KumEQfbZYPLmVi9Gv+pnnJ2bOsLgs+YBUR9BUdB4098CHKH3MrpoI2jzjBKq8hGc= 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=elwoaz2z DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7BE0B4BB58F4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1790850537; x=1822386537; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=c0ekZJfbryX0WnRpmK9zKx/3yPKPColdhbYN8rAA/O4=; b=elwoaz2z8YuoKkUNuVnIVVKo8qGI+kPxUCknpTZ8SiyblBhA/L86PyR4 5XIjeZcZ9fBqueMqn9GiS1vRg+5/p3TaUt/qTp61Shoi20/aX4/1uuCGB cqXWJs2bSMvNlpUhjcNyCoMudN0gwwxAIJkQ7EYJuFWxovmkzq2zpGXuH y9uSYo9A6fxCTyCoFbUAuYcfzLLLHjWHmEvPvJkcdEMaPmAQUX2P4+4v3 jEPAGN9Z1fCxyMyDbqwcEnD2KY3HQGHuxu+y/+ir3+gqzCvDnl8H1WcJz VBuzHUQncldZVQzsQXSZTWON0dyp/h6K/9qBrmdARcT7W374uO7kSyVL/ g==; X-CSE-ConnectionGUID: A7ia0un5Q6ChM2GmgNJ2sw== X-CSE-MsgGUID: hFMmQ0IyQja8ZXJ1JprbXg== X-IronPort-AV: E=McAfee;i="6800,10657,11921"; a="91619612" X-IronPort-AV: E=Sophos;i="6.27,134,1787036400"; d="scan'208";a="91619612" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2026 03:28:56 -0700 X-CSE-ConnectionGUID: HbYiNO9jRo6VzsZT+P/8MA== X-CSE-MsgGUID: toWKB0KISPypj47hXo96Ew== X-ExtLoop1: 1 Received: from gkldtt-dev-004.igk.intel.com (HELO localhost) ([10.123.221.202]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2026 03:28:55 -0700 From: Markus Metzger To: gdb-patches@sourceware.org Subject: [RFC PATCH 2/8] gdb, infrun: track last waitstatus per thread Date: Thu, 1 Oct 2026 12:28:41 +0200 Message-ID: <20261001102847.576880-3-markus.t.metzger@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261001102847.576880-1-markus.t.metzger@intel.com> References: <20261001102847.576880-1-markus.t.metzger@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 --- gdb/gdbthread.h | 3 +++ gdb/infrun.c | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h index 51e9ae1b3f0..fdb6b749387 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h @@ -225,6 +225,9 @@ struct thread_control_state /* Nonzero if stopped due to a step command. */ int stop_step = 0; + /* The last waitstatus for this thread. */ + target_waitstatus stop_ws {}; + /* Chain containing status of breakpoint(s) the thread stopped at. */ bpstat *stop_bpstat = nullptr; diff --git a/gdb/infrun.c b/gdb/infrun.c index a70d88cd4a7..b347459f335 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3134,6 +3134,7 @@ clear_proceed_status_thread (struct thread_info *tp) /* Discard any remaining commands or status from previous stop. */ bpstat_clear (&tp->control.stop_bpstat); + tp->control.stop_ws.set_ignore (); } /* Notify the current interpreter and observers that the target is about to @@ -4169,7 +4170,8 @@ do_target_wait_1 (inferior *inf, ptid_t ptid, } tp->set_stop_reason (TARGET_STOPPED_BY_NO_REASON); - *status = tp->pending_waitstatus (); + tp->control.stop_ws = tp->pending_waitstatus (); + *status = tp->control.stop_ws; tp->set_internal_state (THREAD_INT_STOPPED); tp->clear_pending_waitstatus (); @@ -4187,7 +4189,12 @@ do_target_wait_1 (inferior *inf, ptid_t ptid, if (!target_can_async_p ()) options &= ~TARGET_WNOHANG; - return target_wait (ptid, status, options); + ptid_t event_ptid = target_wait (ptid, status, options); + tp = inf->find_thread (event_ptid); + if (tp != nullptr) + tp->control.stop_ws = *status; + + return event_ptid; } /* Wrapper for target_wait that first checks whether threads have -- 2.53.0 ________________________________________ Intel Deutschland GmbH Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany Tel: +49 (89) 99143-0 www.intel.de Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman Chairperson of the Supervisory Board: Sonja Pierer Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.