summaryrefslogtreecommitdiff
path: root/gdbserver/target.cc
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2022-04-22 21:03:07 +0100
committerPedro Alves <pedro@palves.net>2023-11-13 14:16:11 +0000
commitef980d654ba22aad6b5b301179dd105f522b56a1 (patch)
treec2e8a838980eb8c3dec322a7692bef074cbf7df3 /gdbserver/target.cc
parentd828dbed9c90c568822b230c3bb060ae8c9d4f6f (diff)
gdbserver: Queue no-resumed event after thread exit
Normally, if the last resumed thread on the target exits, the server sends a no-resumed event to GDB. If however, GDB enables the GDB_THREAD_OPTION_EXIT option on a thread, and, that thread exits, the server sends a thread exit event for that thread instead. In all-stop RSP mode, since events can only be forwarded to GDB one at a time, and the whole target stops whenever an event is reported, GDB resumes the target again after getting a THREAD_EXITED event, and then the server finally reports back a no-resumed event if/when appropriate. For non-stop RSP though, events are asynchronous, and if the server sends a thread-exit event for the last resumed thread, the no-resumed event is never sent. This patch makes sure that in non-stop mode, the server queues a no-resumed event after the thread-exit event if it was the last resumed thread that exited. Without this, we'd see failures in step-over-thread-exit testcases added later in the series, like so: continue Continuing. - No unwaited-for children left. - (gdb) PASS: gdb.threads/step-over-thread-exit.exp: displaced-stepping=off: non-stop=on: target-non-stop=on: schedlock=off: ns_stop_all=1: continue stops when thread exits + FAIL: gdb.threads/step-over-thread-exit.exp: displaced-stepping=off: non-stop=on: target-non-stop=on: schedlock=off: ns_stop_all=1: continue stops when thread exits (timeout) (and other similar ones) Reviewed-By: Andrew Burgess <aburgess@redhat.com> Change-Id: I927d78b30f88236dbd5634b051a716f72420e7c7
Diffstat (limited to 'gdbserver/target.cc')
-rw-r--r--gdbserver/target.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdbserver/target.cc b/gdbserver/target.cc
index dbb4e2d9024..81edff41268 100644
--- a/gdbserver/target.cc
+++ b/gdbserver/target.cc
@@ -615,6 +615,12 @@ process_stratum_target::thread_stopped (thread_info *thread)
}
bool
+process_stratum_target::any_resumed ()
+{
+ return true;
+}
+
+bool
process_stratum_target::supports_get_tib_address ()
{
return false;