gdbserver: Use std::list for all_processes
Remove the usage of inferior_list for the all_processes list in gdbserver, replace it with an std::list. The entry field in process_info is removed, and replaced by a simple pid field. The pid_of macro, used for both processes and threads, is replaced with separate functions. For completeness, I changed ptid_of and lwpid_of to functions as well. gdb/gdbserver/ChangeLog: * gdbthread.h (ptid_of, pid_of, lwpid_of): New functions. * inferiors.h: Include <list>. (struct process_info) <entry>: Remove field. <pid>: New field. (pid_of): Change macro to function. (ptid_of, lwpid_of): Remove macro. (all_processes): Change type to std::list<process_info *>. (ALL_PROCESSES): Remove macro. (for_each_process, find_process): New function. * inferiors.c (all_processes): Change type to std::list<process_info *>. (find_thread_process): Adjust. (add_process): Likewise. (remove_process): Likewise. (find_process_pid): Likewise. (get_first_process): Likewise. (started_inferior_callback): Remove. (have_started_inferiors_p): Adjust. (attached_inferior_callback): Remove. (have_attached_inferiors_p): Adjust. * linux-low.c (check_zombie_leaders): Likewise. * linux-x86-low.c (x86_arch_setup_process_callback): Remove. (x86_linux_update_xmltarget): Adjust. * server.c (handle_query): Likewise. (gdb_reattached_process): Remove. (handle_status): Adjust. (kill_inferior_callback): Likewise. (detach_or_kill_inferior): Remove. (print_started_pid): Likewise. (print_attached_pid): Likewise. (detach_or_kill_for_exit): Update. (process_serial_event): Likewise. * linux-arm-low.c (arm_new_fork): Likewise.
This commit is contained in:
parent
c9cb8905b4
commit
9179355e65
8 changed files with 218 additions and 183 deletions
|
@ -854,20 +854,6 @@ x86_linux_read_description (void)
|
|||
gdb_assert_not_reached ("failed to return tdesc");
|
||||
}
|
||||
|
||||
/* Callback for for_each_inferior. Calls the arch_setup routine for
|
||||
each process. */
|
||||
|
||||
static void
|
||||
x86_arch_setup_process_callback (struct inferior_list_entry *entry)
|
||||
{
|
||||
int pid = ptid_get_pid (entry->id);
|
||||
|
||||
/* Look up any thread of this processes. */
|
||||
current_thread = find_any_thread_of_pid (pid);
|
||||
|
||||
the_low_target.arch_setup ();
|
||||
}
|
||||
|
||||
/* Update all the target description of all processes; a new GDB
|
||||
connected, and it may or not support xml target descriptions. */
|
||||
|
||||
|
@ -881,7 +867,14 @@ x86_linux_update_xmltarget (void)
|
|||
release the current regcache objects. */
|
||||
regcache_release ();
|
||||
|
||||
for_each_inferior (&all_processes, x86_arch_setup_process_callback);
|
||||
for_each_process ([] (process_info *proc) {
|
||||
int pid = proc->pid;
|
||||
|
||||
/* Look up any thread of this process. */
|
||||
current_thread = find_any_thread_of_pid (pid);
|
||||
|
||||
the_low_target.arch_setup ();
|
||||
});
|
||||
|
||||
current_thread = saved_thread;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue