From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by sourceware.org (Postfix) with ESMTPS id 3F8603858C35 for ; Tue, 7 May 2024 23:44:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3F8603858C35 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 3F8603858C35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715125467; cv=none; b=Y45u988OiIdHGtv5xGxd/q/0UesiKqjlS7Pat2gPzsF8PqjcSFZ+GLZNpRfccCwqwDxrCeJ2ZHN06zSkLBwAGQEhghvU8e8lSmkA7fbUEjiQmD3jGRgVFbGD4mF0l6t5SPUHiasVTLDjeVcrBCum5qtyVbMp4B4R4vXF8IpEJT0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715125467; c=relaxed/simple; bh=nZVtGf65h7uWDdYloJGNw4gF6IsJANw2ykzVI2lTTM8=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=MslZmTkv2cJxwaz0UFYPQhenmDjbh/gF7FsAoLll+8OdPz7JK1UaM++Rct2N9Qi9lIL2v53LQVQj9m0SpadVBBfZrWfWt1HHhgMw6LRybTxz+rOEa120v/uDYSq5fOdjwEXhqqiRTpNJlpqwhWmokOdpKFAx4MGMjMhgkXNv2SE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-41b794510cdso29749335e9.2 for ; Tue, 07 May 2024 16:44:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715125461; x=1715730261; 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=O1NqyC8Ytjj+anTB1Fafe4Tyl3aGwJQsBnKeNedmXeA=; b=Ea/UST4RvmWQ/lYNSnOqnGiD3KWrljxzCau6152lxecnaazAQ0SCAHva0qeErjn5Qg x8hlafnP7Dvn9wjnttAWEZlFV42LXV84NGEEs4ifSzAY+ifhcMMd/VkwMVjAIq6MoGGr 4nDUsvsIqCXwsn4y1U0FD9zDNpf0qBnR2IEFkQGfakZLf7Jt/yzkFlMVTt2WnIJMSIm1 dBnsygWWCNi1nV0klo4c4c52D6majrOw9n9BSSZeu8b+xjrzBRU2mIVdpnzHNHo6TG2l pILGhSAwW3INeZk1wc6UkeOHdIC5oLaTqKlHkX56pI4sQ46GubXdRmMXxIF0IMt/w3iA lNrA== X-Gm-Message-State: AOJu0Yx281XIOQGmGzTqSY3X4icBGAY1uc2qlzKQ09HrqXKrqxNG4B1Z hd3eh8myg8m0v2T1v920BwEwY7OZBVUTkQg8k+NezeIMkCHn4ktEgA84htsc X-Google-Smtp-Source: AGHT+IHzwr++wxZUofkp0FWWprS9U7MZrkjbN5suLsP1oTm6GLmVDR3NnbEcUpHStIAGYnLv+emrfw== X-Received: by 2002:a05:6000:c4c:b0:34e:34c5:2312 with SMTP id ffacd0b85a97d-34fca80d882mr764744f8f.59.1715125460728; Tue, 07 May 2024 16:44:20 -0700 (PDT) Received: from localhost ([2001:8a0:f908:4900:2dd1:1a0d:2b75:dc42]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-41f87b26605sm2047905e9.9.2024.05.07.16.44.20 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 May 2024 16:44:20 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 26/34] Windows gdb+gdbserver: Eliminate struct pending_stop Date: Wed, 8 May 2024 00:42:25 +0100 Message-ID: <20240507234233.371123-27-pedro@palves.net> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240507234233.371123-1-pedro@palves.net> References: <20240507234233.371123-1-pedro@palves.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 af96811a2ba..6283ff0a4ee 100644 --- a/gdb/nat/windows-nat.h +++ b/gdb/nat/windows-nat.h @@ -32,16 +32,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 @@ -106,8 +96,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 cb35ff41771..7a5b57b24e1 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -1363,7 +1363,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", @@ -1568,18 +1568,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); @@ -1804,7 +1804,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); @@ -1820,7 +1820,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 4707acc4e94..004bf94c83a 100644 --- a/gdbserver/win32-low.cc +++ b/gdbserver/win32-low.cc @@ -848,7 +848,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; } @@ -992,10 +992,10 @@ get_child_debug_event (DWORD *continue_status, auto *th = (windows_thread_info *) thread_target_data (thread); 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)); @@ -1155,13 +1155,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.43.2