From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id saImHXy3o2r3OT8AWB0awg (envelope-from ) for ; Fri, 11 Sep 2026 04:10:36 -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=a2Pjo2RJ; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 67E371E09E; Fri, 11 Sep 2026 04:10:36 -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 A21171E091 for ; Fri, 11 Sep 2026 04:10:34 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7495A48A0832 for ; Fri, 11 Sep 2026 08:10:33 +0000 (GMT) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) by sourceware.org (Postfix) with ESMTPS id 0451948FBCB6 for ; Fri, 11 Sep 2026 08:10:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0451948FBCB6 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 0451948FBCB6 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789114221; cv=none; b=MNMnGmYTl5AbaPY5hPbYdCT3Sd4tJieV9BqNsV77SEvmqkrCmyvzX7HK73S+gY1b2FzvoI+GQoxxwReLI1vJ39MwgltPavwePQlatPxdwccqWebLx849BJIaRv7LbYaqKEkCYtQJQi3Yzo4MrO3XImYxN5zmijiDXN9TI9xJh30= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789114221; c=relaxed/simple; bh=x4syQUl/UDQWVQpbC5USVce6eNWu9pQaSDQUYVWq2uI=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=da4DUGiQ+td00bev67uUQbuxC7vW0HZW21p/laM6HRYaGCxXmHIpO5rDmVXwMfIAjSNHOtWg16G7bx9ZGzIG9FgKTGfGN/c+aT/u8BvJgHLHxuq8kV9yVt/up1QHPm20xX9WwyX7zj3a6CbrKMgg0W0Gv2XX2AArmXVB5GlTkbo= 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=a2Pjo2RJ DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0451948FBCB6 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=a2Pjo2RJ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1789114222; x=1820650222; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=x4syQUl/UDQWVQpbC5USVce6eNWu9pQaSDQUYVWq2uI=; b=a2Pjo2RJP8oGAWT7iJy6s59eVIwoQWqBN+EJSHPyQoVhEm6PcXmuwUzv lzLNCg9y2okntrKwojImxa1qwA1pGORQoQu3aHAj4pZ1F+G+Ym0f/lk/j q3w8FmM6PYn6Rsu4jqFQD1JhDHW9bzAUFTq0M2kbSsY+7z/4hd2ZPXCCz 54Y2NXUZlSsBIiYUKxCbzw0FBOQ8qvM2GWTu5It9oUHQiYIkGf95rNX2m TG5bqCWJ1yan+WObHAZQKMPX7fRNZUwucUNyCxOg1bfk7KwwTI2H/ciCa vPEArkD5YkzoHh8a6Tie5Ydwn/t7Eg7A4DHYB7vZEUFI+nAvzRp4QE3Wv g==; X-CSE-ConnectionGUID: uEswrGHfT0uqM1vFQcAe6A== X-CSE-MsgGUID: uLBehXtDRC2/YG+MtdLYaw== X-IronPort-AV: E=McAfee;i="6800,10657,11901"; a="89339136" X-IronPort-AV: E=Sophos;i="6.27,96,1787036400"; d="scan'208";a="89339136" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2026 01:10:20 -0700 X-CSE-ConnectionGUID: bEeaXD1xTQ2NxJNUTe+WMA== X-CSE-MsgGUID: WP2exqZqQM2aRPlSiwHxkA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,96,1787036400"; d="scan'208";a="268174526" Received: from dut1583dg2frd.igk.intel.com (HELO localhost) ([10.211.179.243]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2026 01:10:18 -0700 From: Klaus Gerlicher To: gdb-patches@sourceware.org Cc: aburgess@redhat.com, pedro@palves.net, kevinb@redhat.com, eliz@gnu.org Subject: [PATCH v4 0/1] gdb: remember previously selected thread per inferior Date: Fri, 11 Sep 2026 08:10:14 +0000 Message-Id: <20260911081015.104335-1-klaus.gerlicher@intel.com> X-Mailer: git-send-email 2.34.1 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: "Gerlicher, Klaus" Hi, This is V4 of the patch to remember the selected thread when switching between inferiors. Thanks, Kevin, for the review. Sorry about that - I shamefully sent out an unfinished/unrebased branch with V3, my workflow is just not well adjusted to upstreaming since I don't do this too regularly. It failed to build and had failing tests and I didn't realize. Apologies for the noise, addressing your findings here, anything else is in V3: https://inbox.sourceware.org/gdb-patches/20260908133426.444197-1-klaus.gerlicher@intel.com/ Changes since V3: * Fixed build failure: 'stored_tp->state' -> 'stored_tp->state ()', since thread_info::state is now a member function. * Fixed test compile issue in inferior-switch.c. * Fixed the test failures you reported: prepare_test in inferior-switch.exp now explicitly enables 'set remember-threads-per-inferior on', since the feature defaults to off as of V3 and the tests never turned it on. * Reworded the texinfo doc per Eli's earlier feedback: "the thread that was selected" instead of "the thread that was active". * Fixed a gap found while re-testing: turning the feature on with 'set remember-threads-per-inferior on' didn't record anything for the inferior currently on - only future explicit/implicit switches got captured. Added a set_func on the setting that captures the current thread right away when enabled. * Added a regression test for that gap; the old tests wouldn't have caught it. * Fixed two stale comments left over from before the set_func was added (one claimed there were only two save mechanisms, the other described save_inferior_last_thread's callers too narrowly). * Documented test_disabled_behavior in the file's header comment; it was missing from the list. Verified this time: * Rebuilt from a clean checkout against current master. * gdb.base/inferior-switch.exp: 47/47 pass. * gdb.mi/user-selected-context-sync.exp: 483/483 pass. Tested on x86_64 and aarch64. Thanks, Klaus Gerlicher, Klaus (1): gdb: remember previously selected thread per inferior gdb/NEWS | 8 + gdb/doc/gdb.texinfo | 20 ++ gdb/gdbthread.h | 4 + gdb/inferior.c | 76 ++++++- gdb/inferior.h | 14 ++ gdb/infrun.c | 12 +- gdb/testsuite/gdb.base/inferior-switch.c | 42 ++++ gdb/testsuite/gdb.base/inferior-switch.exp | 187 ++++++++++++++++++ .../gdb.mi/user-selected-context-sync.exp | 14 ++ gdb/thread.c | 8 + 10 files changed, 382 insertions(+), 3 deletions(-) create mode 100644 gdb/testsuite/gdb.base/inferior-switch.c create mode 100644 gdb/testsuite/gdb.base/inferior-switch.exp -- 2.34.1 ________________________________________ 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.