From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id GI3GFlozK2g2NyoAWB0awg (envelope-from ) for ; Mon, 19 May 2025 09:34:18 -0400 Received: by simark.ca (Postfix, from userid 112) id 5962D1E11C; Mon, 19 May 2025 09:34:18 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-9.0 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (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 A805B1E102 for ; Mon, 19 May 2025 09:34:17 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 599BB3858023 for ; Mon, 19 May 2025 13:34:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 599BB3858023 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by sourceware.org (Postfix) with ESMTPS id 0BFF93858C2C for ; Mon, 19 May 2025 13:24:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0BFF93858C2C 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 0BFF93858C2C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1747661089; cv=none; b=GsWUmg9bFpvSz1TWMBGBzNczhB5QwevCcqSG9m6+JHVHLInCouTJlUS8gICNCr7klhj+A/HG7hUjVvYPENwaLJswfJvipzsJTAO1OXonjALRGAPAyOXOcWWHwBqP1fjyhMjuod6OH305V6uiVzbILa8j+qAqja7Qd2WgcU9Kc+A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1747661089; c=relaxed/simple; bh=cr4AzZSnMlqKm5B/ooh86DbYXSq7da/D7i4gTWibKNM=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=l3jXVkLK5qnkea3HThGT66mm/54XZ5SjvcR7qBpZj0cAvvBxKKYcrrKiNTOwrH1VNGa92F84yLL7ro1JQ9R3o+6d2zNTHaxH+/49DJEcM+/56SVUPG1+h+kee55Gwm386tGrqvWiInKTtj/jCMtunIR72EPTbAwxnn0/O8r+XEg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0BFF93858C2C Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-43ea40a6e98so45925825e9.1 for ; Mon, 19 May 2025 06:24:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747661088; x=1748265888; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Jfk/NQInwrAj+Zdnn7KoyH+l2do66+wlIlqyXYDfVBw=; b=s5VwKkGVQVaGGo/lIi8XPZX0dABBpzZf8FZKkBhm4ik2zYRVXdGIye3sjdL+u0i+/N U1vbuUsYxAtmaeJHFDufOf/+g7DjDGfmEXONnAe5XeOmPkrxG15SdEbB4bEok+Rzy9nT hTIas6ae7kdYGhSJDUMP7fsBnC+RYFnXb2fFY4VwCD5GlbZGxu7oQa6R4IE+YI7duJdp x5MiZyspanZdpQcq2bpwtxUNGayAm+0gXwLe/SJ+kRbY6VtEol/vQu82lXsbbbkL47ff 00IwvKd4xPLJQYsJKYgs1nqhyWNhBpuU0mF2I13+lhtXme7EflHzl7A+3Wyh+vCJXi40 aaDw== X-Gm-Message-State: AOJu0YzMpGMioecnOf3l6ZzbCX2BBQOxaWdZsGw5XtGazfNOmjbqnnlm p4ejJ+mLxp/d6MbYC8NNemJSaw5X6sokMpayKnAuWeXIUXhvmSytFC4MDDX+kJoZ X-Gm-Gg: ASbGncuLgtn8zsIFjHTweb8AE7BUzxX29M9pJklTS9MY27RPmBn5GfU1BkPF1Ndas7P j6ca2zBFGRkwsx/prZKvjAZCOIqO2KEp9pPjF3iZbjEECmStZwKOnTmbnhl5I31+u6MuAnxseS/ Kpnb7zbx6XOVmxf86zRqqmVlXYhaK26g89jHlz/IaZbnqO4gc1vSOAsbxRXwWcs4B12ndcTDFuz CzFsGQXKCdIrLBXsUoBpFS2XFJks1uq5eVjF++bNAvCXmfQxfMTGm4XeCCyEagLYHddBwtnnYmz 23RHYER5Uq+mDU69M/dpe7fQQn4s0dJFbnbS2gVPJLjTJY1g40w= X-Google-Smtp-Source: AGHT+IHAzLXvNKpHUW2Rhj5jVixqOHKvY+FakUmj4ocSHkipH8kqfIjMB2fFvjlWohO6Lw/RWWgZmg== X-Received: by 2002:a05:600c:34c9:b0:43d:fa59:af97 with SMTP id 5b1f17b1804b1-442fd671d12mr108215305e9.32.1747661087500; Mon, 19 May 2025 06:24:47 -0700 (PDT) Received: from localhost ([2001:8a0:4fe9:b400:8d90:6f0d:36bf:32df]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-442f3368fbasm209869365e9.2.2025.05.19.06.24.46 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 May 2025 06:24:47 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 31/47] Windows gdb+gdbserver: Eliminate struct pending_stop Date: Mon, 19 May 2025 14:22:52 +0100 Message-ID: <20250519132308.3553663-32-pedro@palves.net> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250519132308.3553663-1-pedro@palves.net> References: <20250519132308.3553663-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 After the previous patches, struct pending_stop only contains one field. So move that field into the windows_thread_info structure directly, and eliminate struct pending_stop. Change-Id: I7955884b3f378d8b39b908f6252d215f6568b367 --- gdb/nat/windows-nat.h | 17 +++++------------ gdb/windows-nat.c | 14 +++++++------- gdbserver/win32-low.cc | 12 ++++++------ 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h index d0978f899fd..4ec2f4575be 100644 --- a/gdb/nat/windows-nat.h +++ b/gdb/nat/windows-nat.h @@ -38,16 +38,6 @@ namespace windows_nat { -/* Info about a potential pending stop. Each thread holds one of - these. See "windows_thread_info::pending_stop" for more - information. */ -struct pending_stop -{ - /* The target waitstatus we computed. TARGET_WAITKIND_IGNORE if the - thread does not have a pending stop. */ - target_waitstatus status; -}; - struct windows_process_info; /* Thread information structure used to track extra information about @@ -112,8 +102,11 @@ struct windows_thread_info effect of trying to single step thread A -- leaving all other threads suspended -- and then seeing a stop in thread B. To handle this scenario, we queue all such "pending" stops here, and then - process them once the step has completed. See PR gdb/22992. */ - struct pending_stop pending_stop {}; + process them once the step has completed. See PR gdb/22992. + + TARGET_WAITKIND_IGNORE if the thread does not have a pending + stop. */ + target_waitstatus pending_status; /* The last Windows event returned by WaitForDebugEvent for this thread. */ diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index bd3bc3701a6..d5112e2e2e4 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -1273,7 +1273,7 @@ windows_nat_target::windows_continue (DWORD continue_status, int id, { if ((id == -1 || id == (int) th->tid) && !th->suspended - && th->pending_stop.status.kind () != TARGET_WAITKIND_IGNORE) + && th->pending_status.kind () != TARGET_WAITKIND_IGNORE) { DEBUG_EVENTS ("got matching pending stop event " "for 0x%x, not resuming", @@ -1465,18 +1465,18 @@ windows_nat_target::get_windows_debug_event DWORD thread_id = 0; /* If there is a relevant pending stop, report it now. See the - comment by the definition of "windows_thread_info::pending_stop" + comment by the definition of "windows_thread_info::pending_status" for details on why this is needed. */ for (auto &th : windows_process.thread_list) { if (!th->suspended - && th->pending_stop.status.kind () != TARGET_WAITKIND_IGNORE) + && th->pending_status.kind () != TARGET_WAITKIND_IGNORE) { DEBUG_EVENTS ("reporting pending event for 0x%x", th->tid); thread_id = th->tid; - *ourstatus = th->pending_stop.status; - th->pending_stop.status.set_ignore (); + *ourstatus = th->pending_status; + th->pending_status.set_ignore (); *current_event = th->last_event; ptid_t ptid (windows_process.process_id, thread_id); @@ -1701,7 +1701,7 @@ windows_nat_target::get_windows_debug_event if (th->suspended) { /* Pending stop. See the comment by the definition of - "pending_stops" for details on why this is needed. */ + "pending_status" for details on why this is needed. */ DEBUG_EVENTS ("get_windows_debug_event - " "unexpected stop in suspended thread 0x%x", thread_id); @@ -1717,7 +1717,7 @@ windows_nat_target::get_windows_debug_event th->pc_adjusted = false; } - th->pending_stop.status = *ourstatus; + th->pending_status = *ourstatus; ourstatus->set_ignore (); continue_last_debug_event_main_thread diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc index 834af706786..4aaadf0d671 100644 --- a/gdbserver/win32-low.cc +++ b/gdbserver/win32-low.cc @@ -825,7 +825,7 @@ win32_process_target::resume (thread_resume *resume_info, size_t n) } if (!th->suspended - && th->pending_stop.status.kind () != TARGET_WAITKIND_IGNORE) + && th->pending_status.kind () != TARGET_WAITKIND_IGNORE) any_pending = true; }); @@ -970,10 +970,10 @@ get_child_debug_event (DWORD *continue_status, auto *th = static_cast (thread.target_data ()); if (!th->suspended - && th->pending_stop.status.kind () != TARGET_WAITKIND_IGNORE) + && th->pending_status.kind () != TARGET_WAITKIND_IGNORE) { - *ourstatus = th->pending_stop.status; - th->pending_stop.status.set_ignore (); + *ourstatus = th->pending_status; + th->pending_status.set_ignore (); *current_event = th->last_event; ptid = debug_event_ptid (current_event); switch_to_thread (find_thread_ptid (ptid)); @@ -1133,13 +1133,13 @@ get_child_debug_event (DWORD *continue_status, if (th != nullptr && th->suspended) { /* Pending stop. See the comment by the definition of - "windows_thread_info::pending_stop" for details on why this + "windows_thread_info::pending_status" for details on why this is needed. */ OUTMSG2 (("get_windows_debug_event - " "unexpected stop in suspended thread 0x%x\n", th->tid)); maybe_adjust_pc (*current_event); - th->pending_stop.status = *ourstatus; + th->pending_status = *ourstatus; ourstatus->set_spurious (); } else -- 2.49.0