aboutsummaryrefslogtreecommitdiff
path: root/gdbserver/target.h
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.h
parentd828dbed9c90c568822b230c3bb060ae8c9d4f6f (diff)
downloadfsf-binutils-gdb-ef980d654ba22aad6b5b301179dd105f522b56a1.zip
fsf-binutils-gdb-ef980d654ba22aad6b5b301179dd105f522b56a1.tar.gz
fsf-binutils-gdb-ef980d654ba22aad6b5b301179dd105f522b56a1.tar.bz2
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.h')
-rw-r--r--gdbserver/target.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdbserver/target.h b/gdbserver/target.h
index 0f1fd59..28d134e 100644
--- a/gdbserver/target.h
+++ b/gdbserver/target.h
@@ -319,6 +319,9 @@ public:
/* Return true if THREAD is known to be stopped now. */
virtual bool thread_stopped (thread_info *thread);
+ /* Return true if any thread is known to be resumed. */
+ virtual bool any_resumed ();
+
/* Return true if the get_tib_address op is supported. */
virtual bool supports_get_tib_address ();
@@ -683,6 +686,9 @@ target_read_btrace_conf (struct btrace_target_info *tinfo,
#define target_supports_software_single_step() \
the_target->supports_software_single_step ()
+#define target_any_resumed() \
+ the_target->any_resumed ()
+
ptid_t mywait (ptid_t ptid, struct target_waitstatus *ourstatus,
target_wait_flags options, int connected_wait);