]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Windows gdb: Simplify windows_nat_target::wait
authorPedro Alves <pedro@palves.net>
Thu, 11 May 2023 12:16:09 +0000 (13:16 +0100)
committerPedro Alves <pedro@palves.net>
Mon, 19 May 2025 13:12:37 +0000 (14:12 +0100)
commit7c828323382e7672d0b91d5a466320f90deda5d8
tree9f9f1ccb98f4d76f1d8a43cca14beddeeda2ff7a
parentc67956ce05f5810f636cf8e94c0ea2807b9cbee6
Windows gdb: Simplify windows_nat_target::wait

The logic in windows_nat_target::wait, where we decide what to do
depending on the result from get_windows_debug_event is harder to
grasp than it looks.

It is not easy to tell what should happen when in async mode
get_windows_debug_event returns that there's no event to process.

And then, if get_windows_debug_event returns null_ptid /
TARGET_WAITKIND_SPURIOUS, then we need to issue a ContinueDebugEvent.

There's also this comment in windows_nat_target::wait, which we're not
really implementing today:

~~~~
  /* We loop when we get a non-standard exception rather than return
     with a SPURIOUS because resume can try and step or modify things,
     which needs a current_thread->h.  But some of these exceptions mark
     the birth or death of threads, which mean that the current thread
     isn't necessarily what you think it is.  */
~~~~

This patch changes things a bit so that the code is more obvious:

 - look at the status kind, instead of ptid_t.

 - add an explicit early return case for no-event.

 - add an explicit case for TARGET_WAITKIND_SPURIOUS.

 - with those, we no longer need to handle the case of find_thread not
   finding a thread, so we can drop one indentation level.

Change-Id: I76c41762e1f893a7ff23465856ccf6a44af1f0e7
gdb/windows-nat.c