[PATCH v2 25/47] gdb, remote: handle a generic process PID in process_stop_reply

Tankut Baris Aktemur
2024-12-13T16:25:44Z

When processing a new stop reply, the received PID could be a generic
process id (i.e.: is_pid() == true) instead of a specific thread id.
Handle this case.
---
gdb/remote.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/gdb/remote.c b/gdb/remote.c
index 86f9a976a31841a0e53a7fbf0a7eff85f3368d5d..c74f6451b6c1f2a1c2dbcc51c70d8fecc3d82b0e 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -8636,18 +8636,23 @@ remote_target::process_stop_reply (stop_reply_up stop_reply,
}
}

- remote_thread_info *remote_thr = get_remote_thread_info (this, ptid);
- remote_thr->core = stop_reply->core;
- remote_thr->stop_reason = stop_reply->stop_reason;
- remote_thr->watch_data_address = stop_reply->watch_data_address;
-
- if (target_is_non_stop_p ())
+ if (!ptid.is_pid ())
{
- /* If the target works in non-stop mode, a stop-reply indicates that
- only this thread stopped. */
- remote_thr->set_not_resumed ();
+ remote_thread_info *remote_thr
+ = get_remote_thread_info (this, ptid);
+ remote_thr->core = stop_reply->core;
+ remote_thr->stop_reason = stop_reply->stop_reason;
+ remote_thr->watch_data_address = stop_reply->watch_data_address;
+
+ if (target_is_non_stop_p ())
+ {
+ /* If the target works in non-stop mode, a stop-reply
+ indicates that only this thread stopped. */
+ remote_thr->set_not_resumed ();
+ }
}
- else
+
+ if (!target_is_non_stop_p ())
{
/* If the target works in all-stop mode, a stop-reply indicates that
all the target's threads stopped. */