From fa423ba469495cc3dfbf2e9e138c3b3899a9a8f3 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Thu, 11 May 2023 12:27:27 +0100 Subject: [PATCH] Windows gdb+gdbserver: Introduce get_last_debug_event_ptid This will be used in subsequent patches to avoid using DBG_EXCEPTION_NOT_HANDLED on the wrong thread. Change-Id: I32915623b5036fb902f9830ce2d6f0b1ccf1f5cf --- gdb/nat/windows-nat.c | 8 ++++++++ gdb/nat/windows-nat.h | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c index fbb48f8e3ee..fe707fff905 100644 --- a/gdb/nat/windows-nat.c +++ b/gdb/nat/windows-nat.c @@ -637,6 +637,14 @@ windows_process_info::add_all_dlls () /* See nat/windows-nat.h. */ +ptid_t +get_last_debug_event_ptid () +{ + return ptid_t (last_wait_event.dwProcessId, last_wait_event.dwThreadId, 0); +} + +/* See nat/windows-nat.h. */ + BOOL continue_last_debug_event (DWORD continue_status, bool debug_events) { diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h index fec6becb594..8ac16311650 100644 --- a/gdb/nat/windows-nat.h +++ b/gdb/nat/windows-nat.h @@ -278,6 +278,11 @@ private: extern BOOL continue_last_debug_event (DWORD continue_status, bool debug_events); +/* Return the ptid_t of the thread that the last waited-for event was + for. */ + +extern ptid_t get_last_debug_event_ptid (); + /* A simple wrapper for WaitForDebugEvent that also sets the internal 'last_wait_event' on success. */ -- 2.47.2