forked from Imagelibrary/binutils-gdb
gdbserver: Remove duplicate functions to find any thread of process
We have about 6 functions/callbacks to find_inferior meant to find a thread that belongs to a given pid. Remove all but find_any_thread_of_pid and replace their uses with find_any_thread_of_pid. gdb/gdbserver/ChangeLog: * server.c (first_thread_of): Remove. (process_serial_event): Replace usage of first_thread_of with find_any_thread_of_pid. * tracepoint.c (same_process_p): Remove. (gdb_agent_about_to_close): Replace usage of same_process_p with find_any_thread_of_pid. * linux-x86-low.c (same_process_callback): Remove. (x86_arch_setup_process_callback): Replace usage of same_process_callback with find_any_thread_of_pid. * thread-db.c (any_thread_of): Remove. (switch_to_process): Replace usage of any_thread_of with find_any_thread_of_pid. * inferiors.c (thread_pid_matches_callback): Remove. (find_thread_process): Adjust to use find_any_thread_of_pid.
This commit is contained in:
@@ -3956,17 +3956,6 @@ cmd_qtstmat (char *packet)
|
||||
run_inferior_command (packet, strlen (packet) + 1);
|
||||
}
|
||||
|
||||
/* Helper for gdb_agent_about_to_close.
|
||||
Return non-zero if thread ENTRY is in the same process in DATA. */
|
||||
|
||||
static int
|
||||
same_process_p (struct inferior_list_entry *entry, void *data)
|
||||
{
|
||||
int *pid = (int *) data;
|
||||
|
||||
return ptid_get_pid (entry->id) == *pid;
|
||||
}
|
||||
|
||||
/* Sent the agent a command to close it. */
|
||||
|
||||
void
|
||||
@@ -3981,8 +3970,7 @@ gdb_agent_about_to_close (int pid)
|
||||
saved_thread = current_thread;
|
||||
|
||||
/* Find any thread which belongs to process PID. */
|
||||
current_thread = (struct thread_info *)
|
||||
find_inferior (&all_threads, same_process_p, &pid);
|
||||
current_thread = find_any_thread_of_pid (pid);
|
||||
|
||||
strcpy (buf, "close");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user