diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2023-03-27 12:53:55 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2023-04-04 21:05:31 -0400 |
commit | 9213a6d79a64446de3c176773f123d1f8b9311b4 (patch) | |
tree | 6d7374a516e68130713eccfaf3ba60611809c104 | |
parent | 3c8af02fa0b140edcde2a65d016f565aad1a699b (diff) | |
download | binutils-9213a6d79a64446de3c176773f123d1f8b9311b4.zip binutils-9213a6d79a64446de3c176773f123d1f8b9311b4.tar.gz binutils-9213a6d79a64446de3c176773f123d1f8b9311b4.tar.bz2 |
gdb: make find_thread_ptid a process_stratum_target method
Make find_thread_ptid (the overload that takes a process_stratum_target)
a method of process_stratum_target.
Change-Id: Ib190a925a83c6b93e9c585dc7c6ab65efbdd8629
Reviewed-By: Tom Tromey <tom@tromey.com>
-rw-r--r-- | gdb/aarch64-tdep.c | 4 | ||||
-rw-r--r-- | gdb/aix-thread.c | 2 | ||||
-rw-r--r-- | gdb/amd-dbgapi-target.c | 4 | ||||
-rw-r--r-- | gdb/bsd-uthread.c | 4 | ||||
-rw-r--r-- | gdb/darwin-nat.c | 2 | ||||
-rw-r--r-- | gdb/fbsd-nat.c | 2 | ||||
-rw-r--r-- | gdb/gdbthread.h | 4 | ||||
-rw-r--r-- | gdb/gnu-nat.c | 3 | ||||
-rw-r--r-- | gdb/infcmd.c | 2 | ||||
-rw-r--r-- | gdb/infrun.c | 12 | ||||
-rw-r--r-- | gdb/linux-fork.c | 2 | ||||
-rw-r--r-- | gdb/linux-nat.c | 14 | ||||
-rw-r--r-- | gdb/linux-thread-db.c | 12 | ||||
-rw-r--r-- | gdb/mi/mi-interp.c | 2 | ||||
-rw-r--r-- | gdb/netbsd-nat.c | 2 | ||||
-rw-r--r-- | gdb/nto-procfs.c | 6 | ||||
-rw-r--r-- | gdb/process-stratum-target.c | 11 | ||||
-rw-r--r-- | gdb/process-stratum-target.h | 3 | ||||
-rw-r--r-- | gdb/procfs.c | 6 | ||||
-rw-r--r-- | gdb/ravenscar-thread.c | 6 | ||||
-rw-r--r-- | gdb/record-btrace.c | 4 | ||||
-rw-r--r-- | gdb/remote.c | 18 | ||||
-rw-r--r-- | gdb/thread-iter.c | 2 | ||||
-rw-r--r-- | gdb/thread.c | 15 | ||||
-rw-r--r-- | gdb/windows-nat.c | 4 |
25 files changed, 71 insertions, 75 deletions
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index d11d832..a1daa9a 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -3576,9 +3576,7 @@ aarch64_remove_non_address_bits (struct gdbarch *gdbarch, CORE_ADDR pointer) { /* If we do have an inferior, attempt to fetch its thread's thread_info struct. */ - thread_info *thread - = find_thread_ptid (current_inferior ()->process_target (), - inferior_ptid); + thread_info *thread = current_inferior ()->find_thread (inferior_ptid); /* If the thread is running, we will not be able to fetch the mask registers. */ diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index f4ccfb2..c587027 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -941,7 +941,7 @@ sync_threadlists (pid_t pid) if (gptid.is_pid ()) { - tp = find_thread_ptid (proc_target, gptid); + tp = proc_target->find_thread (gptid); thread_change_ptid (proc_target, gptid, pptid); aix_thread_info *priv = new aix_thread_info; priv->pdtid = pbuf[pi].pdtid; diff --git a/gdb/amd-dbgapi-target.c b/gdb/amd-dbgapi-target.c index f516103..f1ef37d 100644 --- a/gdb/amd-dbgapi-target.c +++ b/gdb/amd-dbgapi-target.c @@ -718,7 +718,7 @@ amd_dbgapi_target::stop (ptid_t ptid) { /* No need to iterate all non-exited threads if the request is to stop a specific thread. */ - stop_one_thread (find_thread_ptid (proc_target, ptid)); + stop_one_thread (proc_target->find_thread (ptid)); return; } @@ -998,7 +998,7 @@ process_one_event (amd_dbgapi_event_id_t event_id, else ws.set_stopped (GDB_SIGNAL_0); - thread_info *thread = find_thread_ptid (proc_target, event_ptid); + thread_info *thread = proc_target->find_thread (event_ptid); if (thread == nullptr) { /* Silently create new GPU threads to avoid spamming the diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c index 8b08de8..d0094bd 100644 --- a/gdb/bsd-uthread.c +++ b/gdb/bsd-uthread.c @@ -415,7 +415,7 @@ bsd_uthread_target::wait (ptid_t ptid, struct target_waitstatus *status, thread_change_ptid (beneath, inferior_ptid, ptid); /* Don't let the core see a ptid without a corresponding thread. */ - thread_info *thread = find_thread_ptid (beneath, ptid); + thread_info *thread = beneath->find_thread (ptid); if (thread == NULL || thread->state == THREAD_EXITED) add_thread (beneath, ptid); @@ -466,7 +466,7 @@ bsd_uthread_target::update_thread_list () process_stratum_target *proc_target = as_process_stratum_target (this->beneath ()); - thread_info *thread = find_thread_ptid (proc_target, ptid); + thread_info *thread = proc_target->find_thread (ptid); if (thread == nullptr || thread->state == THREAD_EXITED) { /* If INFERIOR_PTID doesn't have a tid member yet, then ptid diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c index e864c35..4cf2d9f 100644 --- a/gdb/darwin-nat.c +++ b/gdb/darwin-nat.c @@ -360,7 +360,7 @@ darwin_nat_target::check_new_threads (inferior *inf) { /* A thread was removed. */ struct thread_info *thr - = find_thread_ptid (this, ptid_t (inf->pid, 0, old_id)); + = this->find_thread (ptid_t (inf->pid, 0, old_id)); delete_thread (thr); kret = mach_port_deallocate (gdb_task, old_id); MACH_CHECK_ERROR (kret); diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index 04d67fc..b0ca8b0 100644 --- a/gdb/fbsd-nat.c +++ b/gdb/fbsd-nat.c @@ -1295,7 +1295,7 @@ fbsd_nat_target::wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus, threads might be skipped during post_attach that have not yet reported their PL_FLAG_EXITED event. Ignore EXITED events for an unknown LWP. */ - thread_info *thr = find_thread_ptid (this, wptid); + thread_info *thr = this->find_thread (wptid); if (thr != nullptr) { fbsd_lwp_debug_printf ("deleting thread for LWP %u", diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h index 81e4afd..65aab9d 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h @@ -672,10 +672,6 @@ extern bool in_thread_list (process_stratum_target *targ, ptid_t ptid); global id, not the system's). */ extern int valid_global_thread_id (int global_id); -/* Search function to lookup a (non-exited) thread by 'ptid'. */ -extern struct thread_info *find_thread_ptid (process_stratum_target *targ, - ptid_t ptid); - /* Find thread by GDB global thread ID. */ struct thread_info *find_thread_global_id (int global_id); diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index afaec46..1389053 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -2186,8 +2186,7 @@ gnu_nat_target::attach (const char *args, int from_tty) inf_update_procs (inf); - thread_info *thr - = find_thread_ptid (this, ptid_t (pid, inf_pick_first_thread ())); + thread_info *thr = this->find_thread (ptid_t (pid, inf_pick_first_thread ())); switch_to_thread (thr); /* We have to initialize the terminal settings now, since the code diff --git a/gdb/infcmd.c b/gdb/infcmd.c index a686115..1038994 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -710,7 +710,7 @@ continue_command (const char *args, int from_tty) ptid_t last_ptid; get_last_target_status (&last_target, &last_ptid, nullptr); - tp = find_thread_ptid (last_target, last_ptid); + tp = last_target->find_thread (last_ptid); } if (tp != nullptr) bs = tp->control.stop_bpstat; diff --git a/gdb/infrun.c b/gdb/infrun.c index 461855b..ba56fe3 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -876,7 +876,7 @@ follow_fork () /* If we followed the child, switch to it... */ if (follow_child) { - tp = find_thread_ptid (parent_targ, child); + tp = parent_targ->find_thread (child); switch_to_thread (tp); /* ... and preserve the stepping state, in case the @@ -5116,7 +5116,7 @@ handle_one (const wait_one_event &event) } else { - t = find_thread_ptid (event.target, event.ptid); + t = event.target->find_thread (event.ptid); /* Check if this is the first time we see this thread. Don't bother adding if it individually exited. */ if (t == nullptr @@ -5137,7 +5137,7 @@ handle_one (const wait_one_event &event) } else { - thread_info *t = find_thread_ptid (event.target, event.ptid); + thread_info *t = event.target->find_thread (event.ptid); if (t == nullptr) t = add_thread (event.target, event.ptid); @@ -5538,7 +5538,7 @@ handle_inferior_event (struct execution_control_state *ecs) if (ecs->ws.kind () != TARGET_WAITKIND_EXITED && ecs->ws.kind () != TARGET_WAITKIND_SIGNALLED) { - ecs->event_thread = find_thread_ptid (ecs->target, ecs->ptid); + ecs->event_thread = ecs->target->find_thread (ecs->ptid); /* If it's a new thread, add it to the thread database. */ if (ecs->event_thread == nullptr) ecs->event_thread = add_thread (ecs->target, ecs->ptid); @@ -5687,7 +5687,7 @@ handle_inferior_event (struct execution_control_state *ecs) need to have access to the just-exited thread. That is the case of GNU/Linux's "checkpoint" support, for example. Call the switch_to_xxx routine as appropriate. */ - thread_info *thr = find_thread_ptid (ecs->target, ecs->ptid); + thread_info *thr = ecs->target->find_thread (ecs->ptid); if (thr != nullptr) switch_to_thread (thr); else @@ -5874,7 +5874,7 @@ handle_inferior_event (struct execution_control_state *ecs) /* Note that one of these may be an invalid pointer, depending on detach_fork. */ thread_info *parent = ecs->event_thread; - thread_info *child = find_thread_ptid (targ, ecs->ws.child_ptid ()); + thread_info *child = targ->find_thread (ecs->ws.child_ptid ()); /* At this point, the parent is marked running, and the child is marked stopped. */ diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c index a6e74c0..52e3854 100644 --- a/gdb/linux-fork.c +++ b/gdb/linux-fork.c @@ -529,7 +529,7 @@ Please switch to another checkpoint before deleting the current one")); list, waitpid the ptid. If fi->parent_ptid is a part of lwp and it is stopped, waitpid the ptid. */ - thread_info *parent = find_thread_ptid (linux_target, pptid); + thread_info *parent = linux_target->find_thread (pptid); if ((parent == NULL && find_fork_ptid (pptid)) || (parent != NULL && parent->state == THREAD_STOPPED)) { diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index fd80fd9..fba0897 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -903,7 +903,7 @@ linux_nat_switch_fork (ptid_t new_ptid) static void exit_lwp (struct lwp_info *lp) { - struct thread_info *th = find_thread_ptid (linux_target, lp->ptid); + struct thread_info *th = linux_target->find_thread (lp->ptid); if (th) { @@ -1232,7 +1232,7 @@ get_detach_signal (struct lwp_info *lp) signo = gdb_signal_from_host (WSTOPSIG (lp->status)); else { - struct thread_info *tp = find_thread_ptid (linux_target, lp->ptid); + thread_info *tp = linux_target->find_thread (lp->ptid); if (target_is_non_stop_p () && !tp->executing ()) { @@ -1325,7 +1325,7 @@ detach_one_lwp (struct lwp_info *lp, int *signo_p) /* Check in thread_info::pending_waitstatus. */ - thread_info *tp = find_thread_ptid (linux_target, lp->ptid); + thread_info *tp = linux_target->find_thread (lp->ptid); if (tp->has_pending_waitstatus ()) { const target_waitstatus &ws = tp->pending_waitstatus (); @@ -1579,7 +1579,7 @@ linux_nat_resume_callback (struct lwp_info *lp, struct lwp_info *except) { struct thread_info *thread; - thread = find_thread_ptid (linux_target, lp->ptid); + thread = linux_target->find_thread (lp->ptid); if (thread != NULL) { signo = thread->stop_signal (); @@ -1717,7 +1717,7 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping) { struct target_waitstatus *ourstatus = &lp->waitstatus; struct gdbarch *gdbarch = target_thread_architecture (lp->ptid); - thread_info *thread = find_thread_ptid (linux_target, lp->ptid); + thread_info *thread = linux_target->find_thread (lp->ptid); int syscall_number = (int) gdbarch_get_syscall_number (gdbarch, thread); if (stopping) @@ -2996,7 +2996,7 @@ linux_nat_filter_event (int lwpid, int status) if (!lp->step && WSTOPSIG (status) && sigismember (&pass_mask, WSTOPSIG (status)) && (WSTOPSIG (status) != SIGSTOP - || !find_thread_ptid (linux_target, lp->ptid)->stop_requested) + || !linux_target->find_thread (lp->ptid)->stop_requested) && !linux_wstatus_maybe_breakpoint (status)) { linux_resume_one_lwp (lp, lp->step, signo); @@ -4278,7 +4278,7 @@ linux_nat_stop_lwp (struct lwp_info *lwp) if (debug_linux_nat) { - if (find_thread_ptid (linux_target, lwp->ptid)->stop_requested) + if (linux_target->find_thread (lwp->ptid)->stop_requested) linux_nat_debug_printf ("already stopped/stop_requested %s", lwp->ptid.to_string ().c_str ()); else diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index ef1c281..0e190f9 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -422,7 +422,7 @@ thread_from_lwp (thread_info *stopped, ptid_t ptid) thread_db_err_str (err)); /* Fill the cache. */ - tp = find_thread_ptid (stopped->inf->process_target (), ptid); + tp = stopped->inf->process_target ()->find_thread (ptid); return record_thread (info, tp, ptid, &th, &ti); } @@ -439,7 +439,7 @@ thread_db_notice_clone (ptid_t parent, ptid_t child) if (info == NULL) return 0; - thread_info *stopped = find_thread_ptid (linux_target, parent); + thread_info *stopped = linux_target->find_thread (parent); thread_from_lwp (stopped, child); @@ -685,7 +685,7 @@ check_thread_db_callback (const td_thrhandle_t *th, void *arg) to how GDB accesses TLS could result in this passing without exercising the calls it's supposed to. */ ptid_t ptid = ptid_t (tdb_testinfo->info->pid, ti.ti_lid); - thread_info *thread_info = find_thread_ptid (linux_target, ptid); + thread_info *thread_info = linux_target->find_thread (ptid); if (thread_info != NULL && thread_info->priv != NULL) { LOG ("; errno"); @@ -1417,7 +1417,7 @@ thread_db_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, return ptid; /* Fill in the thread's user-level thread id and status. */ - thread_from_lwp (find_thread_ptid (beneath, ptid), ptid); + thread_from_lwp (beneath->find_thread (ptid), ptid); return ptid; } @@ -1511,7 +1511,7 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data) } ptid_t ptid (info->pid, ti.ti_lid); - tp = find_thread_ptid (info->process_target, ptid); + tp = info->process_target->find_thread (ptid); if (tp == NULL || tp->priv == NULL) record_thread (info, tp, ptid, th_p, &ti); @@ -1751,7 +1751,7 @@ thread_db_target::get_thread_local_address (ptid_t ptid, process_stratum_target *beneath = as_process_stratum_target (this->beneath ()); /* Find the matching thread. */ - thread_info = find_thread_ptid (beneath, ptid); + thread_info = beneath->find_thread (ptid); /* We may not have discovered the thread yet. */ if (thread_info != NULL && thread_info->priv == NULL) diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index e1244f3..4f0bbd4 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -1015,7 +1015,7 @@ mi_on_resume (ptid_t ptid) if (ptid == minus_one_ptid || ptid.is_pid ()) tp = inferior_thread (); else - tp = find_thread_ptid (target, ptid); + tp = target->find_thread (ptid); /* Suppress output while calling an inferior function. */ if (tp->control.in_infcall) diff --git a/gdb/netbsd-nat.c b/gdb/netbsd-nat.c index 64f74c9..86df0c8 100644 --- a/gdb/netbsd-nat.c +++ b/gdb/netbsd-nat.c @@ -618,7 +618,7 @@ nbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, threads might be skipped during post_attach that have not yet reported their PTRACE_LWP_EXIT event. Ignore exited events for an unknown LWP. */ - thread_info *thr = find_thread_ptid (this, wptid); + thread_info *thr = this->find_thread (wptid); if (thr == nullptr) ourstatus->set_spurious (); else diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index 8e40efa..61c18fd 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -409,7 +409,7 @@ nto_procfs_target::update_thread_list () (e.g. thread exited). */ continue; ptid = ptid_t (pid, 0, tid); - new_thread = find_thread_ptid (this, ptid); + new_thread = this->find_thread (ptid); if (!new_thread) new_thread = add_thread (ptid); update_thread_private_data (new_thread, tid, status.state, 0); @@ -713,7 +713,7 @@ nto_procfs_target::attach (const char *args, int from_tty) update_thread_list (); - switch_to_thread (find_thread_ptid (this, ptid)); + switch_to_thread (this->find_thread (ptid)); } void @@ -1282,7 +1282,7 @@ nto_procfs_target::create_inferior (const char *exec_file, ptid_t ptid = do_attach (ptid_t (pid)); update_thread_list (); - switch_to_thread (find_thread_ptid (this, ptid)); + switch_to_thread (this->find_thread (ptid)); inf = current_inferior (); inferior_appeared (inf, pid); diff --git a/gdb/process-stratum-target.c b/gdb/process-stratum-target.c index e1d41c8..5c03120 100644 --- a/gdb/process-stratum-target.c +++ b/gdb/process-stratum-target.c @@ -199,6 +199,17 @@ process_stratum_target::random_resumed_with_pending_wait_status /* See process-stratum-target.h. */ +thread_info * +process_stratum_target::find_thread (ptid_t ptid) +{ + inferior *inf = find_inferior_ptid (this, ptid); + if (inf == NULL) + return NULL; + return inf->find_thread (ptid); +} + +/* See process-stratum-target.h. */ + std::set<process_stratum_target *> all_non_exited_process_targets () { diff --git a/gdb/process-stratum-target.h b/gdb/process-stratum-target.h index dcbca5a..35cfd9c 100644 --- a/gdb/process-stratum-target.h +++ b/gdb/process-stratum-target.h @@ -108,6 +108,9 @@ public: thread_info *random_resumed_with_pending_wait_status (inferior *inf, ptid_t filter_ptid); + /* Search function to lookup a (non-exited) thread by 'ptid'. */ + thread_info *find_thread (ptid_t ptid); + /* The connection number. Visible in "info connections". */ int connection_number = 0; diff --git a/gdb/procfs.c b/gdb/procfs.c index 741e62a..7990640 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -2118,7 +2118,7 @@ wait_again: if (print_thread_events) gdb_printf (_("[%s exited]\n"), target_pid_to_str (retval).c_str ()); - delete_thread (find_thread_ptid (this, retval)); + delete_thread (this->find_thread (retval)); target_continue_no_signal (ptid); goto wait_again; } @@ -2225,7 +2225,7 @@ wait_again: if (print_thread_events) gdb_printf (_("[%s exited]\n"), target_pid_to_str (retval).c_str ()); - delete_thread (find_thread_ptid (this, retval)); + delete_thread (this->find_thread (retval)); status->set_spurious (); return retval; } @@ -2854,7 +2854,7 @@ procfs_notice_thread (procinfo *pi, procinfo *thread, void *ptr) { ptid_t gdb_threadid = ptid_t (pi->pid, thread->tid, 0); - thread_info *thr = find_thread_ptid (&the_procfs_target, gdb_threadid); + thread_info *thr = the_procfs_target.find_thread (gdb_threadid); if (thr == NULL || thr->state == THREAD_EXITED) add_thread (&the_procfs_target, gdb_threadid); diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index ad35735..5201613 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -127,7 +127,7 @@ struct ravenscar_thread_target final : public target_ops process_stratum_target *proc_target = as_process_stratum_target (this->beneath ()); ptid_t underlying = get_base_thread_from_ravenscar_task (tp->ptid); - tp = find_thread_ptid (proc_target, underlying); + tp = proc_target->find_thread (underlying); return beneath ()->enable_btrace (tp, conf); } @@ -161,7 +161,7 @@ private: process_stratum_target *proc_target = as_process_stratum_target (this->beneath ()); ptid_t underlying = get_base_thread_from_ravenscar_task (ptid); - switch_to_thread (find_thread_ptid (proc_target, underlying)); + switch_to_thread (proc_target->find_thread (underlying)); } /* Some targets use lazy FPU initialization. On these, the FP @@ -312,7 +312,7 @@ ravenscar_thread_target::add_active_thread () /* The running thread may not have been added to system.tasking.debug's list yet; so ravenscar_update_thread_list may not always add it to the thread list. Add it here. */ - thread_info *active_thr = find_thread_ptid (proc_target, active_ptid); + thread_info *active_thr = proc_target->find_thread (active_ptid); if (active_thr == nullptr) { active_thr = ::add_thread (proc_target, active_ptid); diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 2d88e4d..25ae663 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -1396,7 +1396,7 @@ enum record_method record_btrace_target::record_method (ptid_t ptid) { process_stratum_target *proc_target = current_inferior ()->process_target (); - thread_info *const tp = find_thread_ptid (proc_target, ptid); + thread_info *const tp = proc_target->find_thread (ptid); if (tp == NULL) error (_("No thread.")); @@ -1548,7 +1548,7 @@ record_btrace_target::fetch_registers (struct regcache *regcache, int regno) /* Thread-db may ask for a thread's registers before GDB knows about the thread. We forward the request to the target beneath in this case. */ - thread_info *tp = find_thread_ptid (regcache->target (), regcache->ptid ()); + thread_info *tp = regcache->target ()->find_thread (regcache->ptid ()); if (tp != nullptr) replay = tp->btrace.replay; diff --git a/gdb/remote.c b/gdb/remote.c index 526df31..73deea3 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -2783,7 +2783,7 @@ remote_target::remote_notice_new_inferior (ptid_t currthread, bool executing) /* If this is a new thread, add it to GDB's thread list. If we leave it up to WFI to do this, bad things will happen. */ - thread_info *tp = find_thread_ptid (this, currthread); + thread_info *tp = this->find_thread (currthread); if (tp != NULL && tp->state == THREAD_EXITED) { /* We're seeing an event on a thread id we knew had exited. @@ -2875,7 +2875,7 @@ get_remote_thread_info (thread_info *thread) static remote_thread_info * get_remote_thread_info (remote_target *target, ptid_t ptid) { - thread_info *thr = find_thread_ptid (target, ptid); + thread_info *thr = target->find_thread (ptid); return get_remote_thread_info (thr); } @@ -4175,7 +4175,7 @@ remote_target::update_thread_list () remote_notice_new_inferior (item.ptid, executing); - thread_info *tp = find_thread_ptid (this, item.ptid); + thread_info *tp = this->find_thread (item.ptid); remote_thread_info *info = get_remote_thread_info (tp); info->core = item.core; info->extra = std::move (item.extra); @@ -4771,7 +4771,7 @@ remote_target::process_initial_stop_replies (int from_tty) if (ignore_event) continue; - thread_info *evthread = find_thread_ptid (this, event_ptid); + thread_info *evthread = this->find_thread (event_ptid); if (ws.kind () == TARGET_WAITKIND_STOPPED) { @@ -5123,7 +5123,7 @@ remote_target::start_remote_1 (int from_tty, int extended_p) } } else - switch_to_thread (find_thread_ptid (this, curr_thread)); + switch_to_thread (this->find_thread (curr_thread)); } /* init_wait_for_inferior should be called before get_offsets in order @@ -6192,7 +6192,7 @@ remote_target::remote_detach_1 (inferior *inf, int from_tty) remote_detach_pid (reply->ws.child_ptid ().pid ()); } - thread_info *tp = find_thread_ptid (this, inferior_ptid); + thread_info *tp = this->find_thread (inferior_ptid); /* Check to see if we are detaching a fork parent. Note that if we are detaching a fork child, tp == NULL. */ @@ -6502,10 +6502,10 @@ remote_target::append_resumption (char *p, char *endp, { /* If we don't know about the target thread's tid, then we're resuming magic_null_ptid (see caller). */ - tp = find_thread_ptid (this, magic_null_ptid); + tp = this->find_thread (magic_null_ptid); } else - tp = find_thread_ptid (this, ptid); + tp = this->find_thread (ptid); gdb_assert (tp != NULL); if (tp->control.may_range_step) @@ -13964,7 +13964,7 @@ remote_target::set_disconnected_tracing (int val) int remote_target::core_of_thread (ptid_t ptid) { - thread_info *info = find_thread_ptid (this, ptid); + thread_info *info = this->find_thread (ptid); if (info != NULL && info->priv != NULL) return get_remote_thread_info (info)->core; diff --git a/gdb/thread-iter.c b/gdb/thread-iter.c index 9fc8c8a..f61ce7f 100644 --- a/gdb/thread-iter.c +++ b/gdb/thread-iter.c @@ -122,7 +122,7 @@ all_matching_threads_iterator::all_matching_threads_iterator /* Iterate on a single thread. */ m_mode = mode::SINGLE_THREAD; - m_thr = find_thread_ptid (filter_target, filter_ptid); + m_thr = filter_target->find_thread (filter_ptid); } } } diff --git a/gdb/thread.c b/gdb/thread.c index 38afdff..1c664bc 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -515,17 +515,6 @@ find_thread_id (struct inferior *inf, int thr_num) /* See gdbthread.h. */ struct thread_info * -find_thread_ptid (process_stratum_target *targ, ptid_t ptid) -{ - inferior *inf = find_inferior_ptid (targ, ptid); - if (inf == NULL) - return NULL; - return inf->find_thread (ptid); -} - -/* See gdbthread.h. */ - -struct thread_info * find_thread_by_handle (gdb::array_view<const gdb_byte> handle, struct inferior *inf) { @@ -598,7 +587,7 @@ valid_global_thread_id (int global_id) bool in_thread_list (process_stratum_target *targ, ptid_t ptid) { - return find_thread_ptid (targ, ptid) != nullptr; + return targ->find_thread (ptid) != nullptr; } /* Finds the first thread of the inferior. */ @@ -1333,7 +1322,7 @@ switch_to_thread (thread_info *thr) void switch_to_thread (process_stratum_target *proc_target, ptid_t ptid) { - thread_info *thr = find_thread_ptid (proc_target, ptid); + thread_info *thr = proc_target->find_thread (ptid); switch_to_thread (thr); } diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 26ad04b..c09e459 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -626,7 +626,7 @@ windows_nat_target::delete_thread (ptid_t ptid, DWORD exit_code, target_pid_to_str (ptid).c_str (), (unsigned) exit_code); - ::delete_thread (find_thread_ptid (this, ptid)); + ::delete_thread (this->find_thread (ptid)); auto iter = std::find_if (windows_process.thread_list.begin (), windows_process.thread_list.end (), @@ -1944,7 +1944,7 @@ windows_nat_target::do_initial_windows_stuff (DWORD pid, bool attaching) this->resume (minus_one_ptid, 0, GDB_SIGNAL_0); } - switch_to_thread (find_thread_ptid (this, last_ptid)); + switch_to_thread (this->find_thread (last_ptid)); /* Now that the inferior has been started and all DLLs have been mapped, we can iterate over all DLLs and load them in. |