-/* Structure used to look up a thread to use as current when accessing
- memory. */
-
-struct thread_search
-{
- /* The PTID of the current general thread. This is an input
- parameter. */
- ptid_t current_gen_ptid;
-
- /* The first thread found. */
- struct thread_info *first;
-
- /* The first stopped thread found. */
- struct thread_info *stopped;
-
- /* The current general thread, if found. */
- struct thread_info *current;
-};
-
-/* Callback for find_inferior. Search for a thread to use as current
- when accessing memory. */
-
-static int
-thread_search_callback (struct inferior_list_entry *entry, void *args)
-{
- struct thread_info *thread = (struct thread_info *) entry;
- struct thread_search *s = (struct thread_search *) args;
-
- if (ptid_get_pid (entry->id) == ptid_get_pid (s->current_gen_ptid)
- && mythread_alive (ptid_of (thread)))
- {
- if (s->stopped == NULL
- && the_target->thread_stopped != NULL
- && thread_stopped (thread))
- s->stopped = thread;
-
- if (s->first == NULL)
- s->first = thread;
-
- if (s->current == NULL && ptid_equal (s->current_gen_ptid, entry->id))
- s->current = thread;
- }
-
- return 0;
-}
-