aboutsummaryrefslogtreecommitdiff
path: root/gdb/thread.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2008-09-22 15:18:30 +0000
committerPedro Alves <palves@redhat.com>2008-09-22 15:18:30 +0000
commit82f7388440b4dc733616a6a85e9dfd290089e508 (patch)
tree96f5da1d4b95212f3c2a569382a9d017fcf46047 /gdb/thread.c
parent7f9f62ba187205cd123fd2e96909e6d19ad708eb (diff)
downloadfsf-binutils-gdb-82f7388440b4dc733616a6a85e9dfd290089e508.zip
fsf-binutils-gdb-82f7388440b4dc733616a6a85e9dfd290089e508.tar.gz
fsf-binutils-gdb-82f7388440b4dc733616a6a85e9dfd290089e508.tar.bz2
Implement remote multi-process extensions.
* remote.c (struct remote_state): Add extended and multi_process_aware fields. (remote_multi_process_p): New. (PACKET_vKill): New. (record_currthread): Use thread_change_ptid. Notice new inferiors. (set_thread, remote_thread_alive): Use write_ptid. (write_ptid, read_ptid): New. (remote_current_thread, remote_threads_extra_info): Use them. (remote_threads_info): Likewise. Detect new inferiors. (remote_start_remote): Add inferior to inferior list. (remote_multi_process_feature): New. (remote_protocol_features): Add "multiprocess" feature. (remote_query_supported): Pass "multiprocess+" as supported features. (remote_open_1): Clear multi_process_aware. Set extended accordingly. (remote_detach_1): Detach current process. Use extended packet format for extended-remote multi-process. Detach process from the inferior list. Only mourn after printing output. (extended_remote_attach_1): Add process to the inferior list. (remote_vcont_resume): Use write_ptid to pass the thread ids. (remote_wait): Use read_ptid. Implement the extended multi-process extension format of the 'W' and 'X' reply packets. Remove exited inferiors from inferior list. (remote_xfer_memory): Set general thread. (remote_vkill): New. (extended_remote_kill): New. (remote_mourn_1): Discard all inferiors. (select_new_thread_callback): New. (extended_remote_mourn_1): If there are more processes to debug, switch to a thread in another process, and don't pop the target. (extended_remote_create_inferior_1): Add the new process to the inferior list. (remote_stopped_by_watchpoint): Indenting. (remote_xfer_partial): Set the general thread. (remote_pid_to_str): If the remote is multi-process aware, print the process id as well as the thread id. (remote_get_thread_local_address): Use write_ptid. (init_extended_remote_ops): Register extended_remote_kill. (_initialize_remote): Register new packets. Change magic_null_ptid's, not_sent_ptid's and any_thread_ptid's pid member to 42000. * thread.c (thread_change_ptid): Also account for the inferior pid changing. * inferior.h (discard_all_inferiors): Declare. * inferior.c (discard_all_inferiors): New.
Diffstat (limited to 'gdb/thread.c')
-rw-r--r--gdb/thread.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gdb/thread.c b/gdb/thread.c
index 03d031d..94e1873 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -466,7 +466,16 @@ prune_threads (void)
void
thread_change_ptid (ptid_t old_ptid, ptid_t new_ptid)
{
- struct thread_info * tp = find_thread_pid (old_ptid);
+ struct inferior *inf;
+ struct thread_info *tp;
+
+ /* It can happen that what we knew as the target inferior id
+ changes. E.g, target remote may only discover the remote process
+ pid after adding the inferior to GDB's list. */
+ inf = find_inferior_pid (ptid_get_pid (old_ptid));
+ inf->pid = ptid_get_pid (new_ptid);
+
+ tp = find_thread_pid (old_ptid);
tp->ptid = new_ptid;
observer_notify_thread_ptid_changed (old_ptid, new_ptid);