From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id xUqLEhm/mmqrXSgAWB0awg (envelope-from ) for ; Fri, 04 Sep 2026 08:52:41 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=palves.net header.i=@palves.net header.a=rsa-sha256 header.s=dreamhost header.b=pLIJy6hg; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 2A43B1E166; Fri, 04 Sep 2026 08:52: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=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, 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 35C751E09B for ; Fri, 04 Sep 2026 08:52:40 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BB3AD4BA2E1A for ; Fri, 4 Sep 2026 12:52:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BB3AD4BA2E1A Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=palves.net header.i=@palves.net header.a=rsa-sha256 header.s=dreamhost header.b=pLIJy6hg Received: from rusty.tulip.relay.mailchannels.net (rusty.tulip.relay.mailchannels.net [23.83.218.252]) by sourceware.org (Postfix) with ESMTPS id A783E4BA902C for ; Fri, 4 Sep 2026 12:52:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A783E4BA902C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=palves.net ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A783E4BA902C Authentication-Results: sourceware.org; arc=none smtp.remote-ip=23.83.218.252 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788526328; cv=none; b=tStqps12lGiWFziYgy1jvvc0TDOJny/7PQFp+25HnYDIRhPTWWHdgsJoWiVTqisEggP6zzm8Vbl5TjWE2SmaOUApfLoIJIQIe7kBuR/MW4oyXtWbXJdR3WM/3uzswUSTiec2woV+Tc06dJuaQ+gA7DCuJDTajLRGvNbPwXk2Cb8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788526328; c=relaxed/simple; bh=PIe1n8fIi5ZCiFnO6pPJaz/PG8xmYHw6aBEaEfqC+34=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=LXqSSYD3TPKUrQgvo63w8+binmyyax2hoiaEQo+H73ZBSBwgjDQ/RRvogR+BUbkRGlMOAgAHgO6ujXbf72UaJ4agxsqSs8Cc8s61GBqHt8l06bU/jDZgtB25BOFaQ8Elv0U92CJSi5Ox5MSoi4dVgyKBtX+FUWVd52K5yxol3h0= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=palves.net header.i=@palves.net header.a=rsa-sha256 header.s=dreamhost header.b=pLIJy6hg DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A783E4BA902C X-Sender-Id: dreamhost|x-authsender|pedro@palves.net Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id B11B88008EE; Fri, 04 Sep 2026 12:52:07 +0000 (UTC) Received: from pdx1-sub0-mail-a209.dreamhost.com (trex-green-7.trex.outbound.svc.cluster.local [100.96.147.44]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 4B6AC801727; Fri, 04 Sep 2026 12:52:03 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|pedro@palves.net X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|pedro@palves.net X-MailChannels-Auth-Id: dreamhost X-Broad-Reaction: 25f05e051dd0b7c4_1788526327542_3637096966 X-MC-Loop-Signature: 1788526327542:4030795534 X-MC-Ingress-Time: 1788526327542 Received: from pdx1-sub0-mail-a209.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.96.147.44 (trex/8.0.2); Fri, 04 Sep 2026 12:52:07 +0000 Received: from [192.168.0.201] (bl22-81-37.dsl.telepac.pt [2.83.81.37]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pedro@palves.net) by pdx1-sub0-mail-a209.dreamhost.com (Postfix) with ESMTPSA id 4hbxDy4Ccmz34; Fri, 4 Sep 2026 05:52:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=palves.net; s=dreamhost; t=1788526323; bh=WHepWv2YHGgib64wV665inbGzbKgLsgW1dMhd+hvKGo=; h=Date:Subject:To:From:Content-Type:Content-Transfer-Encoding; b=pLIJy6hg3CoUG41nY/yD3C0+Iiqr3+Xy8xz8ARbWYR7y5eFF9FZ14WuU3kNUi27RN 5YyDxOGfH2RgiDG9d7vn8mCXtE6v8R6bbfPGJWBbltYWM5/rANNFr4UQ4Jf/3wv4Y9 4dud5HoYabbQDVv9kS2qa8weYAcVeRQbhZ+rF0iHNDlqnqUpVy4uqSj0h5no3/DSum inseAw6Qv9Tl/wClmmSFp98BhKT40yc23HcFPUKERFj91N+x/XTWQKeTpcyeF9qeQp LENZqpZKkiVkHSH79P3zpaBORZsh/JkIYQoeZPIPYTZidROxuM+Rx8tkNNNKULeruG S4Elpu2kuQoZg== Message-ID: Date: Fri, 4 Sep 2026 13:51:54 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Return correct thread for cached event To: Tom Tromey , gdb-patches@sourceware.org References: <20260902180928.3545493-1-tromey@adacore.com> From: Pedro Alves Content-Language: en-US In-Reply-To: <20260902180928.3545493-1-tromey@adacore.com> Content-Type: text/plain; charset=UTF-8 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 On 2026-09-02 19:09, Tom Tromey wrote: > Commit 2e1aacf15a9 ("Windows gdb+gdbserver: Make current_event > per-thread state") introduced a regression. This was detected by the > AdaCore internal test suite in a somewhat unusual configuration: when > using "attach" with a 32-bit Windows process, an extra stop would be > generated, like: > > (gdb) break break_me > Breakpoint 1 at 0x1211a04: file pck.adb, line 18. > (gdb) continue > Continuing. > > Thread 4 received signal SIGINT, Interrupt. > [Switching to thread 4 (Thread 6652)] > 0x77034210 in ntdll!RtlUserThreadStart () from C:/Windows/SysWOW64/ntdll.dll > > Here, we expect to stop in break_me, but instead stop in some Windows > DLL. > > I tracked this down to this hunk in the aforementioned commit: > > - return debug_event_ptid (&windows_process.current_event); > + return ptid_t (windows_process.process_id, > + windows_process.main_thread_id, 0); > > What happens here is that the "cached" stop ends up being reported in > the main thread, rather than whatever thread actually caused this > stop. Ouch, sorry about this. And thanks for all the investigation. I must have very early on in the non-stop work assumed that the initial events all come from the main thread, but later on I learned that they don't (I even ran into that very nasty bug that led to the state => internal_state split), and missed this assumption here. > > This patch fixes the problem by arranging to also cache the thread > ptid. > > I am not sure whether the call to switch_to_thread here is really > needed; but since other returns seem to switch the thread, I thought > this one ought to as well. > > I tested this using the AdaCore internal test suite. > > As this is a regression, when it lands I also plan to apply it to the > gdb 18 branch. > > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34583 Approved-by: Pedro Alves