diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2017-09-15 14:53:07 +0200 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2017-09-15 14:53:20 +0200 |
commit | 785922a559529420ce9b11342d7abe6ad32b3595 (patch) | |
tree | 29852cf6dff0066ee4c2128e57f5059a4159d146 /gdb/gdbserver/inferiors.c | |
parent | 8d20070632b608587f372cf2d36ead339487e49c (diff) | |
download | gdb-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/inferiors.c')
-rw-r--r-- | gdb/gdbserver/inferiors.c | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/gdb/gdbserver/inferiors.c b/gdb/gdbserver/inferiors.c index 3c171a1..2212850 100644 --- a/gdb/gdbserver/inferiors.c +++ b/gdb/gdbserver/inferiors.c @@ -141,25 +141,13 @@ find_thread_ptid (ptid_t ptid) return (struct thread_info *) find_inferior_id (&all_threads, ptid); } -/* Predicate function for matching thread entry's pid to the given - pid value passed by address in ARGS. */ - -static int -thread_pid_matches_callback (struct inferior_list_entry *entry, void *args) -{ - return (ptid_get_pid (entry->id) == *(pid_t *)args); -} - /* Find a thread associated with the given PROCESS, or NULL if no such thread exists. */ static struct thread_info * find_thread_process (const struct process_info *const process) { - pid_t pid = ptid_get_pid (ptid_of (process)); - - return (struct thread_info *) - find_inferior (&all_threads, thread_pid_matches_callback, &pid); + return find_any_thread_of_pid (process->entry.id.pid ()); } /* Helper for find_any_thread_of_pid. Returns true if a thread |