aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/server.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@ericsson.com>2017-09-15 14:53:07 +0200
committerSimon Marchi <simon.marchi@ericsson.com>2017-09-15 14:53:20 +0200
commit785922a559529420ce9b11342d7abe6ad32b3595 (patch)
tree29852cf6dff0066ee4c2128e57f5059a4159d146 /gdb/gdbserver/server.c
parent8d20070632b608587f372cf2d36ead339487e49c (diff)
downloadgdb-785922a559529420ce9b11342d7abe6ad32b3595.zip
gdb-785922a559529420ce9b11342d7abe6ad32b3595.tar.gz
gdb-785922a559529420ce9b11342d7abe6ad32b3595.tar.bz2
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.
Diffstat (limited to 'gdb/gdbserver/server.c')
-rw-r--r--gdb/gdbserver/server.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 56c6393..bedb87b 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -3450,17 +3450,6 @@ gdbserver_show_disableable (FILE *stream)
break; \
}
-static int
-first_thread_of (struct inferior_list_entry *entry, void *args)
-{
- int pid = * (int *) args;
-
- if (ptid_get_pid (entry->id) == pid)
- return 1;
-
- return 0;
-}
-
static void
kill_inferior_callback (struct inferior_list_entry *entry)
{
@@ -4162,11 +4151,9 @@ process_serial_event (void)
&& ptid_equal (pid_to_ptid (pid),
gdb_id))
{
- struct thread_info *thread =
- (struct thread_info *) find_inferior (&all_threads,
- first_thread_of,
- &pid);
- if (!thread)
+ thread_info *thread = find_any_thread_of_pid (pid);
+
+ if (thread == NULL)
{
write_enn (own_buf);
break;