[PATCH v2 35/47] gdb, ze: on a whole process stop, mark all threads as not_resumed

Tankut Baris Aktemur
2024-12-13T16:30:27Z

From: Klaus Gerlicher <klaus.gerlicher@intel.com>

In non-stop mode, when gdbserver sends a unavailable notification via a
library load stop-reply, set all non-exited threads to non_resumed
state in case it's a whole process stop-reply.
---
gdb/remote.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/gdb/remote.c b/gdb/remote.c
index c74f6451b6c1f2a1c2dbcc51c70d8fecc3d82b0e..e9a8ded65cca34c2554173db6ed4d085f2335ee5 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -8652,11 +8652,18 @@ remote_target::process_stop_reply (stop_reply_up stop_reply,
}
}

- if (!target_is_non_stop_p ())
+ if (!target_is_non_stop_p () || ptid.is_pid ())
{
/* If the target works in all-stop mode, a stop-reply indicates that
- all the target's threads stopped. */
- for (thread_info *tp : all_non_exited_threads (this))
+ all the target's threads stopped.
+
+ In non-stop mode, a process-wide stop-reply indicates that
+ all the threads of that process stopped. */
+ ptid_t filter_ptid = (!target_is_non_stop_p ()
+ ? minus_one_ptid
+ : ptid);
+
+ for (thread_info *tp : all_non_exited_threads (this, filter_ptid))
get_remote_thread_info (tp)->set_not_resumed ();
}
}