From b34f362bd3708bb786d64dc819ad2b4b1f84f55f Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 22 Sep 2008 15:18:30 +0000 Subject: 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. --- gdb/inferior.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gdb/inferior.c') diff --git a/gdb/inferior.c b/gdb/inferior.c index 2c9c0af0873..128e8fc50a6 100644 --- a/gdb/inferior.c +++ b/gdb/inferior.c @@ -170,6 +170,18 @@ detach_inferior (int pid) printf_unfiltered (_("[Inferior %d detached]\n"), pid); } +void +discard_all_inferiors (void) +{ + struct inferior *inf, *infnext; + + for (inf = inferior_list; inf; inf = infnext) + { + infnext = inf->next; + delete_inferior_silent (inf->pid); + } +} + static struct inferior * find_inferior_id (int num) { -- cgit v1.2.1