Re: [PATCH v2 20/47] Windows gdb+gdbserver: Elim desired_stop_thread_id / rework pending_stops

Tom Tromey
2025-05-30T20:41:51Z

>>>>> "Pedro" == Pedro Alves <pedro@palves.net> writes:

Pedro> windows_process.desired_stop_thread_id doesn't work for non-stop, as
Pedro> in that case every thread will have its own independent
Pedro> WaitForDebugEvent event.

Pedro> Instead, detect whether we have been reported a stop that was not
Pedro> supposed to be reported by simply checking whether the thread that is
Pedro> reporting the event is suspended. This is now easilly possible since
Pedro> each thread's suspend state is kept in sync with whether infrun wants
Pedro> the thread executing or not.

Thanks, this makes sense to me.

Pedro> I considered whether it would be possible to keep the pending_stop
Pedro> handling code shared in gdb/nat/windows-nat.c, in this patch and
Pedro> throughout the series, but I conclused that it isn't worth it, until
Pedro> gdbserver is taught about async and non-stop as well.

Makes sense as well. For future tasks like this, perhaps a bug report
would be useful.

Approved-By: Tom Tromey <tom@tromey.com>

Tom