diff options
Diffstat (limited to 'gdbserver')
-rw-r--r-- | gdbserver/gdbthread.h | 8 | ||||
-rw-r--r-- | gdbserver/inferiors.cc | 2 | ||||
-rw-r--r-- | gdbserver/linux-low.cc | 75 | ||||
-rw-r--r-- | gdbserver/linux-mips-low.cc | 2 | ||||
-rw-r--r-- | gdbserver/mem-break.cc | 10 | ||||
-rw-r--r-- | gdbserver/netbsd-low.cc | 8 | ||||
-rw-r--r-- | gdbserver/server.cc | 6 |
7 files changed, 51 insertions, 60 deletions
diff --git a/gdbserver/gdbthread.h b/gdbserver/gdbthread.h index 87fa3f6..f1922f94 100644 --- a/gdbserver/gdbthread.h +++ b/gdbserver/gdbthread.h @@ -136,14 +136,6 @@ thread_info *find_thread_in_random thread_info *find_thread_in_random (ptid_t ptid, gdb::function_view<bool (thread_info *)> func); -/* Get the ptid of THREAD. */ - -static inline ptid_t -ptid_of (const thread_info *thread) -{ - return thread->id; -} - /* Get the pid of THREAD. */ static inline int diff --git a/gdbserver/inferiors.cc b/gdbserver/inferiors.cc index 7657ddb..e72b1c9 100644 --- a/gdbserver/inferiors.cc +++ b/gdbserver/inferiors.cc @@ -105,7 +105,7 @@ process_info::remove_thread (thread_info *thread) if (thread->btrace != NULL) target_disable_btrace (thread->btrace); - discard_queued_stop_replies (ptid_of (thread)); + discard_queued_stop_replies (thread->id); if (current_thread == thread) switch_to_thread (nullptr); diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc index 28d07d9..6da1256 100644 --- a/gdbserver/linux-low.cc +++ b/gdbserver/linux-low.cc @@ -141,8 +141,7 @@ enum tribool have_ptrace_getregset = TRIBOOL_UNKNOWN; static bool is_leader (thread_info *thread) { - ptid_t ptid = ptid_of (thread); - return ptid.pid () == ptid.lwp (); + return thread->id.pid () == thread->id.lwp (); } /* Return true if we should report thread exit events to GDB, for @@ -164,7 +163,7 @@ report_exit_events_for (thread_info *thr) ptid_t ptid_of_lwp (struct lwp_info *lwp) { - return ptid_of (get_lwp_thread (lwp)); + return get_lwp_thread (lwp)->id; } /* See nat/linux-nat.h. */ @@ -546,13 +545,13 @@ linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp, : event == PTRACE_EVENT_VFORK ? "vfork" : event == PTRACE_EVENT_CLONE ? "clone" : "???"), - ptid_of (event_thr).lwp (), + event_thr->id.lwp (), new_pid); } ptid_t child_ptid = (event != PTRACE_EVENT_CLONE ? ptid_t (new_pid, new_pid) - : ptid_t (ptid_of (event_thr).pid (), new_pid)); + : ptid_t (event_thr->id.pid (), new_pid)); process_info *child_proc = nullptr; @@ -686,7 +685,7 @@ linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp, { threads_debug_printf ("not reporting clone event from LWP %ld, new child is %ld\n", - ptid_of (event_thr).lwp (), + event_thr->id.lwp (), new_pid); return 1; } @@ -703,7 +702,7 @@ linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp, : event == PTRACE_EVENT_VFORK ? "vfork" : event == PTRACE_EVENT_CLONE ? "clone" : "???"), - ptid_of (event_thr).lwp (), + event_thr->id.lwp (), new_pid); return 0; } @@ -731,7 +730,7 @@ linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp, lwpid_of (event_thr)); /* Get the event ptid. */ - event_ptid = ptid_of (event_thr); + event_ptid = event_thr->id; event_pid = event_ptid.pid (); /* Save the syscall list from the execing process. */ @@ -889,7 +888,7 @@ linux_process_target::save_stop_reason (lwp_info *lwp) { threads_debug_printf ("%s stopped by software breakpoint", - target_pid_to_str (ptid_of (get_lwp_thread (lwp))).c_str ()); + target_pid_to_str (get_lwp_thread (lwp)->id).c_str ()); /* Back up the PC if necessary. */ if (pc != sw_breakpoint_pc) @@ -905,15 +904,15 @@ linux_process_target::save_stop_reason (lwp_info *lwp) else if (lwp->stop_reason == TARGET_STOPPED_BY_HW_BREAKPOINT) threads_debug_printf ("%s stopped by hardware breakpoint", - target_pid_to_str (ptid_of (get_lwp_thread (lwp))).c_str ()); + target_pid_to_str (get_lwp_thread (lwp)->id).c_str ()); else if (lwp->stop_reason == TARGET_STOPPED_BY_WATCHPOINT) threads_debug_printf ("%s stopped by hardware watchpoint", - target_pid_to_str (ptid_of (get_lwp_thread (lwp))).c_str ()); + target_pid_to_str (get_lwp_thread (lwp)->id).c_str ()); else if (lwp->stop_reason == TARGET_STOPPED_BY_SINGLE_STEP) threads_debug_printf ("%s stopped by trace", - target_pid_to_str (ptid_of (get_lwp_thread (lwp))).c_str ()); + target_pid_to_str (get_lwp_thread (lwp)->id).c_str ()); lwp->stop_pc = pc; return true; @@ -1294,7 +1293,7 @@ linux_kill_one_lwp (struct lwp_info *lwp) int save_errno = errno; threads_debug_printf ("kill_lwp (SIGKILL) %s, 0, 0 (%s)", - target_pid_to_str (ptid_of (thr)).c_str (), + target_pid_to_str (thr->id).c_str (), save_errno ? safe_strerror (save_errno) : "OK"); } @@ -1305,7 +1304,7 @@ linux_kill_one_lwp (struct lwp_info *lwp) int save_errno = errno; threads_debug_printf ("PTRACE_KILL %s, 0, 0 (%s)", - target_pid_to_str (ptid_of (thr)).c_str (), + target_pid_to_str (thr->id).c_str (), save_errno ? safe_strerror (save_errno) : "OK"); } } @@ -1316,8 +1315,8 @@ static void kill_wait_lwp (struct lwp_info *lwp) { struct thread_info *thr = get_lwp_thread (lwp); - int pid = ptid_of (thr).pid (); - int lwpid = ptid_of (thr).lwp (); + int pid = thr->id.pid (); + int lwpid = thr->id.lwp (); int wstat; int res; @@ -1437,7 +1436,7 @@ get_detach_signal (struct thread_info *thread) if (!WIFSTOPPED (status)) { threads_debug_printf ("lwp %s hasn't stopped: no pending signal", - target_pid_to_str (ptid_of (thread)).c_str ()); + target_pid_to_str (thread->id).c_str ()); return 0; } @@ -1446,7 +1445,7 @@ get_detach_signal (struct thread_info *thread) { threads_debug_printf ("lwp %s had stopped with extended " "status: no pending signal", - target_pid_to_str (ptid_of (thread)).c_str ()); + target_pid_to_str (thread->id).c_str ()); return 0; } @@ -1455,7 +1454,7 @@ get_detach_signal (struct thread_info *thread) if (cs.program_signals_p && !cs.program_signals[signo]) { threads_debug_printf ("lwp %s had signal %s, but it is in nopass state", - target_pid_to_str (ptid_of (thread)).c_str (), + target_pid_to_str (thread->id).c_str (), gdb_signal_to_string (signo)); return 0; } @@ -1468,14 +1467,14 @@ get_detach_signal (struct thread_info *thread) threads_debug_printf ("lwp %s had signal %s, " "but we don't know if we should pass it. " "Default to not.", - target_pid_to_str (ptid_of (thread)).c_str (), + target_pid_to_str (thread->id).c_str (), gdb_signal_to_string (signo)); return 0; } else { threads_debug_printf ("lwp %s has pending signal %s: delivering it", - target_pid_to_str (ptid_of (thread)).c_str (), + target_pid_to_str (thread->id).c_str (), gdb_signal_to_string (signo)); return WSTOPSIG (status); @@ -1493,7 +1492,7 @@ linux_process_target::detach_one_lwp (lwp_info *lwp) if (lwp->stop_expected) { threads_debug_printf ("Sending SIGCONT to %s", - target_pid_to_str (ptid_of (thread)).c_str ()); + target_pid_to_str (thread->id).c_str ()); kill_lwp (lwpid_of (thread), SIGCONT); lwp->stop_expected = 0; @@ -1549,13 +1548,13 @@ linux_process_target::detach_one_lwp (lwp_info *lwp) else { error (_("Can't detach %s: %s"), - target_pid_to_str (ptid_of (thread)).c_str (), + target_pid_to_str (thread->id).c_str (), safe_strerror (save_errno)); } } else threads_debug_printf ("PTRACE_DETACH (%s, %s, 0) (OK)", - target_pid_to_str (ptid_of (thread)).c_str (), + target_pid_to_str (thread->id).c_str (), strsignal (sig)); delete_lwp (lwp); @@ -2432,14 +2431,14 @@ linux_process_target::filter_event (int lwpid, int wstat) /* We want to report the stop to the core. Treat the SIGSTOP as a normal event. */ threads_debug_printf ("resume_stop SIGSTOP caught for %s.", - target_pid_to_str (ptid_of (thread)).c_str ()); + target_pid_to_str (thread->id).c_str ()); } else if (stopping_threads != NOT_STOPPING_THREADS) { /* Stopping threads. We don't want this SIGSTOP to end up pending. */ threads_debug_printf ("SIGSTOP caught for %s while stopping threads.", - target_pid_to_str (ptid_of (thread)).c_str ()); + target_pid_to_str (thread->id).c_str ()); return; } else @@ -2447,7 +2446,7 @@ linux_process_target::filter_event (int lwpid, int wstat) /* This is a delayed SIGSTOP. Filter out the event. */ threads_debug_printf ("%s %s, 0, 0 (discard delayed SIGSTOP)", child->stepping ? "step" : "continue", - target_pid_to_str (ptid_of (thread)).c_str ()); + target_pid_to_str (thread->id).c_str ()); resume_one_lwp (child, child->stepping, 0, NULL); return; @@ -2494,7 +2493,7 @@ linux_process_target::resume_stopped_resumed_lwps (thread_info *thread) } threads_debug_printf ("resuming stopped-resumed LWP %s at %s: step=%d", - target_pid_to_str (ptid_of (thread)).c_str (), + target_pid_to_str (thread->id).c_str (), paddress (lp->stop_pc), step); resume_one_lwp (lp, step, GDB_SIGNAL_0, NULL); @@ -2735,7 +2734,7 @@ select_event_lwp (struct lwp_info **orig_lp) if (event_thread != NULL) threads_debug_printf ("Select single-step %s", - target_pid_to_str (ptid_of (event_thread)).c_str ()); + target_pid_to_str (event_thread->id).c_str ()); } if (event_thread == NULL) { @@ -2899,7 +2898,7 @@ linux_process_target::filter_exit_event (lwp_info *event_child, target_waitstatus *ourstatus) { struct thread_info *thread = get_lwp_thread (event_child); - ptid_t ptid = ptid_of (thread); + ptid_t ptid = thread->id; if (ourstatus->kind () == TARGET_WAITKIND_THREAD_EXITED) { @@ -3045,7 +3044,7 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus, threads_debug_printf ("ret = %s, exited with retcode %d", - target_pid_to_str (ptid_of (current_thread)).c_str (), + target_pid_to_str (current_thread->id).c_str (), WEXITSTATUS (w)); } else @@ -3054,7 +3053,7 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus, threads_debug_printf ("ret = %s, terminated with signal %d", - target_pid_to_str (ptid_of (current_thread)).c_str (), + target_pid_to_str (current_thread->id).c_str (), WTERMSIG (w)); } @@ -3086,7 +3085,7 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus, threads_debug_printf ("step-over for %s executed software breakpoint", - target_pid_to_str (ptid_of (current_thread)).c_str ()); + target_pid_to_str (current_thread->id).c_str ()); if (increment_pc != 0) { @@ -3240,9 +3239,9 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus, threads_debug_printf ("ret = %s, stopped while stabilizing threads", - target_pid_to_str (ptid_of (current_thread)).c_str ()); + target_pid_to_str (current_thread->id).c_str ()); - return ptid_of (current_thread); + return current_thread->id; } } } @@ -3622,7 +3621,7 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus, gdb_assert (step_over_bkpt == null_ptid); threads_debug_printf ("ret = %s, %s", - target_pid_to_str (ptid_of (current_thread)).c_str (), + target_pid_to_str (current_thread->id).c_str (), ourstatus->to_string ().c_str ()); return filter_exit_event (event_child, ourstatus); @@ -3921,7 +3920,7 @@ linux_process_target::stop_all_lwps (int suspend, lwp_info *except) threads_debug_printf ("%s, except=%s", suspend ? "stop-and-suspend" : "stop", (except != NULL - ? target_pid_to_str (ptid_of (get_lwp_thread (except))).c_str () + ? target_pid_to_str (get_lwp_thread (except)->id).c_str () : "none")); stopping_threads = (suspend @@ -6981,7 +6980,7 @@ linux_process_target::read_btrace_conf (const btrace_target_info *tinfo, ptid_t current_lwp_ptid (void) { - return ptid_of (current_thread); + return current_thread->id; } /* A helper function that copies NAME to DEST, replacing non-printable diff --git a/gdbserver/linux-mips-low.cc b/gdbserver/linux-mips-low.cc index 9c03741..a7b772d 100644 --- a/gdbserver/linux-mips-low.cc +++ b/gdbserver/linux-mips-low.cc @@ -499,7 +499,7 @@ mips_target::low_new_fork (process_info *parent, void mips_target::low_prepare_to_resume (lwp_info *lwp) { - ptid_t ptid = ptid_of (get_lwp_thread (lwp)); + ptid_t ptid = get_lwp_thread (lwp)->id; struct process_info *proc = find_process_pid (ptid.pid ()); struct arch_process_info *priv = proc->priv->arch_private; diff --git a/gdbserver/mem-break.cc b/gdbserver/mem-break.cc index 818f004..7ebb8c4 100644 --- a/gdbserver/mem-break.cc +++ b/gdbserver/mem-break.cc @@ -1421,7 +1421,7 @@ delete_single_step_breakpoints (struct thread_info *thread) while (bp) { if (bp->type == single_step_breakpoint - && ((struct single_step_breakpoint *) bp)->ptid == ptid_of (thread)) + && ((struct single_step_breakpoint *) bp)->ptid == thread->id) { scoped_restore_current_thread restore_thread; @@ -1513,7 +1513,7 @@ uninsert_single_step_breakpoints (struct thread_info *thread) for (bp = proc->breakpoints; bp != NULL; bp = bp->next) { if (bp->type == single_step_breakpoint - && ((struct single_step_breakpoint *) bp)->ptid == ptid_of (thread)) + && ((struct single_step_breakpoint *) bp)->ptid == thread->id) { gdb_assert (bp->raw->inserted > 0); @@ -1585,7 +1585,7 @@ has_single_step_breakpoints (struct thread_info *thread) while (bp) { if (bp->type == single_step_breakpoint - && ((struct single_step_breakpoint *) bp)->ptid == ptid_of (thread)) + && ((struct single_step_breakpoint *) bp)->ptid == thread->id) return 1; else { @@ -1619,7 +1619,7 @@ reinsert_single_step_breakpoints (struct thread_info *thread) for (bp = proc->breakpoints; bp != NULL; bp = bp->next) { if (bp->type == single_step_breakpoint - && ((struct single_step_breakpoint *) bp)->ptid == ptid_of (thread)) + && ((struct single_step_breakpoint *) bp)->ptid == thread->id) { gdb_assert (bp->raw->inserted > 0); @@ -2145,7 +2145,7 @@ clone_all_breakpoints (struct thread_info *child_thread, for (bp = parent_proc->breakpoints; bp != NULL; bp = bp->next) { - new_bkpt = clone_one_breakpoint (bp, ptid_of (child_thread)); + new_bkpt = clone_one_breakpoint (bp, child_thread->id); APPEND_TO_LIST (new_list, new_bkpt, bkpt_tail); APPEND_TO_LIST (new_raw_list, new_bkpt->raw, raw_bkpt_tail); } diff --git a/gdbserver/netbsd-low.cc b/gdbserver/netbsd-low.cc index 332186f..4e459e6 100644 --- a/gdbserver/netbsd-low.cc +++ b/gdbserver/netbsd-low.cc @@ -132,7 +132,7 @@ netbsd_process_target::resume (struct thread_resume *resume_info, size_t n) const bool step = resume_info[0].kind == resume_step; if (resume_ptid == minus_one_ptid) - resume_ptid = ptid_of (current_thread); + resume_ptid = current_thread->id; const pid_t pid = resume_ptid.pid (); const lwpid_t lwp = resume_ptid.lwp (); @@ -483,7 +483,7 @@ void netbsd_process_target::fetch_registers (struct regcache *regcache, int regno) { const netbsd_regset_info *regset = get_regs_info (); - ptid_t inferior_ptid = ptid_of (current_thread); + ptid_t inferior_ptid = current_thread->id; while (regset->size >= 0) { @@ -504,7 +504,7 @@ void netbsd_process_target::store_registers (struct regcache *regcache, int regno) { const netbsd_regset_info *regset = get_regs_info (); - ptid_t inferior_ptid = ptid_of (current_thread); + ptid_t inferior_ptid = current_thread->id; while (regset->size >= 0) { @@ -551,7 +551,7 @@ netbsd_process_target::write_memory (CORE_ADDR memaddr, void netbsd_process_target::request_interrupt () { - ptid_t inferior_ptid = ptid_of (get_first_thread ()); + ptid_t inferior_ptid = get_first_thread ()->id; ::kill (inferior_ptid.pid (), SIGINT); } diff --git a/gdbserver/server.cc b/gdbserver/server.cc index 0d7b1ed..7731cfa 100644 --- a/gdbserver/server.cc +++ b/gdbserver/server.cc @@ -1007,7 +1007,7 @@ handle_general_set (char *own_buf) for_each_thread ([&] (thread_info *thread) { - if (ptid_of (thread).matches (ptid)) + if (thread->id.matches (ptid)) set_options[thread] = options; }); } @@ -1020,7 +1020,7 @@ handle_general_set (char *own_buf) if (thread->thread_options != options) { threads_debug_printf ("[options for %s are now %s]\n", - target_pid_to_str (ptid_of (thread)).c_str (), + target_pid_to_str (thread->id).c_str (), to_string (options).c_str ()); thread->thread_options = options; @@ -1994,7 +1994,7 @@ handle_qxfer_statictrace (const char *annex, static void handle_qxfer_threads_worker (thread_info *thread, std::string *buffer) { - ptid_t ptid = ptid_of (thread); + ptid_t ptid = thread->id; char ptid_s[100]; int core = target_core_of_thread (ptid); char core_s[21]; |