aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2023-05-11 12:27:27 +0100
committerPedro Alves <pedro@palves.net>2024-05-10 11:25:59 +0100
commit4ae1d3c664c18e08d8bb4ed11c3336bf0f4d21c2 (patch)
treeb8b3c4354bc02c5efc2fc6fe42e7f48fcf85f0cf
parent3a84bb42a39aefdbb682a65871e6ca4ea622a7b7 (diff)
downloadgdb-4ae1d3c664c18e08d8bb4ed11c3336bf0f4d21c2.zip
gdb-4ae1d3c664c18e08d8bb4ed11c3336bf0f4d21c2.tar.gz
gdb-4ae1d3c664c18e08d8bb4ed11c3336bf0f4d21c2.tar.bz2
Windows gdb: Can't pass signal to thread other than last stopped thread
Passing a signal to a thread other than the one that last reported an event would be later possible with DBG_REPLY_LATER and a backend working in non-stop mode. With an all-stop backend that isn't possible, so at least don't incorrectly consider passing DBG_EXCEPTION_NOT_HANDLED if the thread that we're going to call ContinueDebugEvent for is not the one that the user issued "signal SIG" on. Change-Id: I32915623b5036fb902f9830ce2d6f0b1ccf1f5cf
-rw-r--r--gdb/windows-nat.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 7a03c8f..d783148 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1422,10 +1422,21 @@ windows_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
if (sig != GDB_SIGNAL_0)
{
- if (windows_process.current_event.dwDebugEventCode
+ /* Note it is OK to call get_last_debug_event_ptid() from the
+ main thread here, because we know the process_thread thread
+ isn't waiting for an event at this point, so there's no data
+ race. */
+ if (inferior_ptid != get_last_debug_event_ptid ())
+ {
+ /* ContinueDebugEvent will be for a different thread. */
+ DEBUG_EXCEPT ("Cannot continue with signal %d here. "
+ "Not last-event thread", sig);
+ }
+ else if (windows_process.current_event.dwDebugEventCode
!= EXCEPTION_DEBUG_EVENT)
{
- DEBUG_EXCEPT ("Cannot continue with signal %d here.", sig);
+ DEBUG_EXCEPT ("Cannot continue with signal %d here. "
+ "Not stopped for EXCEPTION_DEBUG_EVENT", sig);
}
else if (sig == windows_process.last_sig)
continue_status = DBG_EXCEPTION_NOT_HANDLED;