From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 3VDfOZvW62kyVDkAWB0awg (envelope-from ) for ; Fri, 24 Apr 2026 16:46:19 -0400 Received: by simark.ca (Postfix, from userid 112) id CC93E1E0BA; Fri, 24 Apr 2026 16:46:19 -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.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, 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 DBC2A1E0B1 for ; Fri, 24 Apr 2026 16:46:18 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 5E1684B920FD for ; Fri, 24 Apr 2026 20:46:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5E1684B920FD Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by sourceware.org (Postfix) with ESMTPS id 8D3644B92092 for ; Fri, 24 Apr 2026 20:45:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8D3644B92092 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8D3644B92092 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777063531; cv=none; b=iPoc3nlPoswOaJGNm1Xh383HG7nO0+x3SiV+/+HqM56TtN0dacwnuMghw+/fvSKcleLRJC/kIKEi/SiiaIR+fhoUaO7N1d2CD1exxGhY5Yg1CQIj6fj+hV9f5/OmuqRvJgaU2jAITqyKWVBRPQr9qwXBLmxpwYkFkh0m/kuQy/c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777063531; c=relaxed/simple; bh=bX98e+pZDO+GDWf6qBAvxh2QdFrxEN85CSIM6UO5UuA=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=cHjsirAKHzO1+Tuau0JAwQMD/QW0ogsPaqsNUG4+7crBWQ/LBxDlv3aBV7UZlbTnlDqPy7aiaCNx3WzRQr3wpsYnEWhipfff2WC2/ukLa485c+OyDEDnckw3f23Fet1VvRfy4ib67/gfHneW1f++aPggCUk5rE5mTzErNNEe35s= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D3644B92092 Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-43d76dd4ee8so7476539f8f.2 for ; Fri, 24 Apr 2026 13:45:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777063530; x=1777668330; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=KbWfSOjuTSzXBJ+GokB03MR+UprEMEczGqeO9447x6Q=; b=nsqQQue+3LHEmad2bvIFi6W3TMDcnnMbCcTfnD44ePW7UvmOFkbO77ftxB3YYYzKg/ IdUhk36Raf4b+HI3b2rCsUiBDT0aS0jQ6fuVnqEK4w/GpjExQVU7ig60P5tjMlUSTfwC wiZTj6yKOutjg/58iaDwbv/j8u3/NkmpWxoxzGM6ftDahpMLVLRNO/acGNNNOwD9rrCP JJWcGc1J8H8eaf0Saw5PvYnoAWKiR2jCW2YBIXZa6A9F+v4UrrmVC6tRRNlYfozRLlpL dNsMUxzQ4usYYi4c4tWPCHtSAt5onMlTs9rl82KJ/ty7cGgpEDfZGrcopJqt8JsZGIXA k8qw== X-Gm-Message-State: AOJu0YxVVD+PmzRCm3NSatsaJsCxtkIrpXjH+XS1ke6vWLDWf3bs0iBE m5FtVLaiYv5sbhiNMpy0XMTVz0qsX77mDU448x14daF+vLbp7cVDVEwLjSc0uQ2V X-Gm-Gg: AeBDietTmLysWzCsplha2Zd4f8hcJqPKaefshA8+P/1jdywCxgTIFPdsLfyvRk9lGg4 PLHylyP8bSJ+oZCSWWm2HNWhKs5QxGXdtpwdV7YJ/G7jH4DUUaVEPDkAiNTicK8+9K/XlZbBa+d OhSj4E8QWd3cSzham4TX2z/2rJzvajLDlK9QdgJaj2XM7rIVtCVe7IMvC7Zly/+hrXB9bnKecWn /Sv9mEAYCkoPz4xoT/R4xrRk4kGcIeC2Hbb+UY4qfshmyWVgmuXtLheVrSxNlvfqJAti1ZX/0cZ XXDNgi8Ag19zjVCRI2WjcPQWzObBCEPGx9SmYoiK0xjXhCzeDVer7ssU3InGdqP7cKd75gcnb3a MjnPoDIkkyoDFCHczed/vsXbrWymiyUokupmB+bSB7dJeK5CjtwCNBKoCkl+YUgrMyMHka3xt8N wiwGf+ylckC7SPn+kcft0xYqugOoI9OShp X-Received: by 2002:a05:6000:184d:b0:43d:6fb7:fee1 with SMTP id ffacd0b85a97d-43fe3e23a59mr52365495f8f.46.1777063530119; Fri, 24 Apr 2026 13:45:30 -0700 (PDT) Received: from localhost ([2001:8a0:facb:a800:7315:8865:c664:fc06]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-43fe4e4d6casm59512920f8f.32.2026.04.24.13.45.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Apr 2026 13:45:29 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [pushed 05/28] Windows gdb+gdbserver: Eliminate DONT_SUSPEND Date: Fri, 24 Apr 2026 21:44:45 +0100 Message-ID: <20260424204508.1343973-6-pedro@palves.net> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260424204508.1343973-1-pedro@palves.net> References: <20260424204508.1343973-1-pedro@palves.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 There's a single call to thread_rec(DONT_SUSPEND), in windows_process_info::handle_exception. In GDB, the windows-nat.c thread_rec implementation avoids actually calling SuspendThread on the event thread by doing: th->suspended = -1; I am not exactly sure why, but it kind of looks like it is done as an optimization, avoiding a SuspendThread call? It is probably done for the same reason as the code touched in the previous patch avoided suspending the event thread. This however gets in the way of non-stop mode, which will really want to SuspendThread the event thread for DBG_REPLY_LATER. In gdbserver's thread_rec implementation DONT_SUSPEND is ignored, and thread_rec actually always suspends, which really suggests that SuspendThread on the event thread is really not a problem. I really can't imagine why it would be. DONT_SUSPEND invalidates the thread's context, but there is no need to invalidate the context when we get an event for a thread, because we invalidate it when we previously resumed the thread. So, we can just remove the thread_rec call from windows_process_info::handle_exception. That's what this patch does. Approved-By: Tom Tromey Change-Id: I0f328542bda6d8268814ca1ee4ae7a478098ecf2 --- gdb/nat/windows-nat.c | 4 ---- gdb/nat/windows-nat.h | 2 -- gdb/windows-nat.c | 11 ----------- 3 files changed, 17 deletions(-) diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c index cefd335f652..16d4acae569 100644 --- a/gdb/nat/windows-nat.c +++ b/gdb/nat/windows-nat.c @@ -356,10 +356,6 @@ windows_process_info::handle_exception (struct target_waitstatus *ourstatus, memcpy (&siginfo_er, rec, sizeof siginfo_er); - /* Record the context of the current thread. */ - thread_rec (ptid_t (current_event.dwProcessId, current_event.dwThreadId, 0), - DONT_SUSPEND); - last_sig = GDB_SIGNAL_0; switch (code) diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h index 1a564fbf11b..2cc665fb53c 100644 --- a/gdb/nat/windows-nat.h +++ b/gdb/nat/windows-nat.h @@ -107,8 +107,6 @@ struct windows_thread_info /* Possible values to pass to 'thread_rec'. */ enum thread_disposition_type { - /* Invalidate the context, but do not suspend the thread. */ - DONT_SUSPEND, }; /* A single pending stop. See "pending_stops" for more diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index ca9a197d64e..aae4de42a73 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -279,17 +279,6 @@ windows_per_inferior::thread_rec (ptid_t ptid, thread_disposition_type disposition) { windows_thread_info *th = find_thread (ptid); - - if (th != nullptr && !th->suspended) - { - switch (disposition) - { - case DONT_SUSPEND: - th->suspended = -1; - invalidate_thread_context (th); - break; - } - } return th; } -- 2.53.0