mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-27 01:28:46 +00:00
gdbserver: remove lwpid_of(thread)
This function doesn't seem so useful. Use `thread_info:🆔:lwp` directly. Change-Id: Ib4a86eeeee6c1342bc1c092f083589ce28009be1 Reviewed-By: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
This commit is contained in:
@@ -399,7 +399,7 @@ linux_process_target::delete_lwp (lwp_info *lwp)
|
||||
{
|
||||
thread_info *thr = get_lwp_thread (lwp);
|
||||
|
||||
threads_debug_printf ("deleting %ld", lwpid_of (thr));
|
||||
threads_debug_printf ("deleting %ld", thr->id.lwp ());
|
||||
|
||||
thr->process ()->remove_thread (thr);
|
||||
|
||||
@@ -519,7 +519,7 @@ linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp,
|
||||
int ret, status;
|
||||
|
||||
/* Get the pid of the new lwp. */
|
||||
ptrace (PTRACE_GETEVENTMSG, lwpid_of (event_thr), (PTRACE_TYPE_ARG3) 0,
|
||||
ptrace (PTRACE_GETEVENTMSG, event_thr->id.lwp (), (PTRACE_TYPE_ARG3) 0,
|
||||
&new_pid);
|
||||
|
||||
/* If we haven't already seen the new PID stop, wait for it now. */
|
||||
@@ -727,7 +727,7 @@ linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp,
|
||||
pid_t event_pid;
|
||||
|
||||
threads_debug_printf ("Got exec event from LWP %ld",
|
||||
lwpid_of (event_thr));
|
||||
event_thr->id.lwp ());
|
||||
|
||||
/* Get the event ptid. */
|
||||
event_ptid = event_thr->id;
|
||||
@@ -751,7 +751,7 @@ linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp,
|
||||
/* Set the event status. */
|
||||
event_lwp->waitstatus.set_execd
|
||||
(make_unique_xstrdup
|
||||
(linux_proc_pid_to_exec_file (lwpid_of (event_thr))));
|
||||
(linux_proc_pid_to_exec_file (event_thr->id.lwp ())));
|
||||
|
||||
/* Mark the exec status as pending. */
|
||||
event_lwp->stopped = 1;
|
||||
@@ -842,7 +842,7 @@ linux_process_target::save_stop_reason (lwp_info *lwp)
|
||||
scoped_restore_current_thread restore_thread;
|
||||
switch_to_thread (get_lwp_thread (lwp));
|
||||
|
||||
if (ptrace (PTRACE_GETSIGINFO, lwpid_of (current_thread),
|
||||
if (ptrace (PTRACE_GETSIGINFO, current_thread->id.lwp (),
|
||||
(PTRACE_TYPE_ARG3) 0, &siginfo) == 0)
|
||||
{
|
||||
if (siginfo.si_signo == SIGTRAP)
|
||||
@@ -1025,7 +1025,7 @@ linux_process_target::post_create_inferior ()
|
||||
struct process_info *proc = current_process ();
|
||||
int options = linux_low_ptrace_options (proc->attached);
|
||||
|
||||
linux_enable_event_reporting (lwpid_of (current_thread), options);
|
||||
linux_enable_event_reporting (current_thread->id.lwp (), options);
|
||||
lwp->must_set_ptrace_flags = 0;
|
||||
}
|
||||
}
|
||||
@@ -1271,7 +1271,7 @@ static void
|
||||
linux_kill_one_lwp (struct lwp_info *lwp)
|
||||
{
|
||||
struct thread_info *thr = get_lwp_thread (lwp);
|
||||
int pid = lwpid_of (thr);
|
||||
int pid = thr->id.lwp ();
|
||||
|
||||
/* PTRACE_KILL is unreliable. After stepping into a signal handler,
|
||||
there is no signal context, and ptrace(PTRACE_KILL) (or
|
||||
@@ -1364,7 +1364,7 @@ kill_one_lwp_callback (thread_info *thread, int pid)
|
||||
the children get a chance to be reaped, it will remain a zombie
|
||||
forever. */
|
||||
|
||||
if (lwpid_of (thread) == pid)
|
||||
if (thread->id.lwp () == pid)
|
||||
{
|
||||
threads_debug_printf ("is last of process %s",
|
||||
target_pid_to_str (thread->id).c_str ());
|
||||
@@ -1486,7 +1486,6 @@ linux_process_target::detach_one_lwp (lwp_info *lwp)
|
||||
{
|
||||
struct thread_info *thread = get_lwp_thread (lwp);
|
||||
int sig;
|
||||
int lwpid;
|
||||
|
||||
/* If there is a pending SIGSTOP, get rid of it. */
|
||||
if (lwp->stop_expected)
|
||||
@@ -1494,7 +1493,7 @@ linux_process_target::detach_one_lwp (lwp_info *lwp)
|
||||
threads_debug_printf ("Sending SIGCONT to %s",
|
||||
target_pid_to_str (thread->id).c_str ());
|
||||
|
||||
kill_lwp (lwpid_of (thread), SIGCONT);
|
||||
kill_lwp (thread->id.lwp (), SIGCONT);
|
||||
lwp->stop_expected = 0;
|
||||
}
|
||||
|
||||
@@ -1518,7 +1517,7 @@ linux_process_target::detach_one_lwp (lwp_info *lwp)
|
||||
throw;
|
||||
}
|
||||
|
||||
lwpid = lwpid_of (thread);
|
||||
int lwpid = thread->id.lwp ();
|
||||
if (ptrace (PTRACE_DETACH, lwpid, (PTRACE_TYPE_ARG3) 0,
|
||||
(PTRACE_TYPE_ARG4) (long) sig) < 0)
|
||||
{
|
||||
@@ -1680,7 +1679,7 @@ linux_process_target::thread_still_has_status_pending (thread_info *thread)
|
||||
if (pc != lp->stop_pc)
|
||||
{
|
||||
threads_debug_printf ("PC of %ld changed",
|
||||
lwpid_of (thread));
|
||||
thread->id.lwp ());
|
||||
discard = 1;
|
||||
}
|
||||
|
||||
@@ -1901,7 +1900,7 @@ lwp_suspended_inc (struct lwp_info *lwp)
|
||||
if (lwp->suspended > 4)
|
||||
threads_debug_printf
|
||||
("LWP %ld has a suspiciously high suspend count, suspended=%d",
|
||||
lwpid_of (get_lwp_thread (lwp)), lwp->suspended);
|
||||
get_lwp_thread (lwp)->id.lwp (), lwp->suspended);
|
||||
}
|
||||
|
||||
/* Decrement LWP's suspend count. */
|
||||
@@ -1915,7 +1914,7 @@ lwp_suspended_decr (struct lwp_info *lwp)
|
||||
{
|
||||
struct thread_info *thread = get_lwp_thread (lwp);
|
||||
|
||||
internal_error ("unsuspend LWP %ld, suspended=%d\n", lwpid_of (thread),
|
||||
internal_error ("unsuspend LWP %ld, suspended=%d\n", thread->id.lwp (),
|
||||
lwp->suspended);
|
||||
}
|
||||
}
|
||||
@@ -1980,7 +1979,7 @@ linux_process_target::linux_fast_tracepoint_collecting
|
||||
thread is which when tracing with the in-process agent library.
|
||||
We don't read anything from the address, and treat it as opaque;
|
||||
it's the address itself that we assume is unique per-thread. */
|
||||
if (low_get_thread_area (lwpid_of (thread), &thread_area) == -1)
|
||||
if (low_get_thread_area (thread->id.lwp (), &thread_area) == -1)
|
||||
return fast_tpoint_collect_result::not_collecting;
|
||||
|
||||
return fast_tracepoint_collecting (thread_area, lwp->stop_pc, status);
|
||||
@@ -2007,7 +2006,7 @@ linux_process_target::maybe_move_out_of_jump_pad (lwp_info *lwp, int *wstat)
|
||||
|
||||
threads_debug_printf
|
||||
("Checking whether LWP %ld needs to move out of the jump pad.",
|
||||
lwpid_of (current_thread));
|
||||
current_thread->id.lwp ());
|
||||
|
||||
fast_tpoint_collect_result r
|
||||
= linux_fast_tracepoint_collecting (lwp, &status);
|
||||
@@ -2034,7 +2033,7 @@ linux_process_target::maybe_move_out_of_jump_pad (lwp_info *lwp, int *wstat)
|
||||
|
||||
threads_debug_printf
|
||||
("Checking whether LWP %ld needs to move out of the jump pad..."
|
||||
" it does", lwpid_of (current_thread));
|
||||
" it does", current_thread->id.lwp ());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -2064,14 +2063,14 @@ linux_process_target::maybe_move_out_of_jump_pad (lwp_info *lwp, int *wstat)
|
||||
|| WSTOPSIG (*wstat) == SIGFPE
|
||||
|| WSTOPSIG (*wstat) == SIGBUS
|
||||
|| WSTOPSIG (*wstat) == SIGSEGV)
|
||||
&& ptrace (PTRACE_GETSIGINFO, lwpid_of (current_thread),
|
||||
&& ptrace (PTRACE_GETSIGINFO, current_thread->id.lwp (),
|
||||
(PTRACE_TYPE_ARG3) 0, &info) == 0
|
||||
/* Final check just to make sure we don't clobber
|
||||
the siginfo of non-kernel-sent signals. */
|
||||
&& (uintptr_t) info.si_addr == lwp->stop_pc)
|
||||
{
|
||||
info.si_addr = (void *) (uintptr_t) status.tpoint_addr;
|
||||
ptrace (PTRACE_SETSIGINFO, lwpid_of (current_thread),
|
||||
ptrace (PTRACE_SETSIGINFO, current_thread->id.lwp (),
|
||||
(PTRACE_TYPE_ARG3) 0, &info);
|
||||
}
|
||||
|
||||
@@ -2104,7 +2103,7 @@ linux_process_target::maybe_move_out_of_jump_pad (lwp_info *lwp, int *wstat)
|
||||
|
||||
threads_debug_printf
|
||||
("Checking whether LWP %ld needs to move out of the jump pad... no",
|
||||
lwpid_of (current_thread));
|
||||
current_thread->id.lwp ());
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -2118,7 +2117,7 @@ enqueue_one_deferred_signal (struct lwp_info *lwp, int *wstat)
|
||||
struct thread_info *thread = get_lwp_thread (lwp);
|
||||
|
||||
threads_debug_printf ("Deferring signal %d for LWP %ld.",
|
||||
WSTOPSIG (*wstat), lwpid_of (thread));
|
||||
WSTOPSIG (*wstat), thread->id.lwp ());
|
||||
|
||||
if (debug_threads)
|
||||
{
|
||||
@@ -2139,7 +2138,7 @@ enqueue_one_deferred_signal (struct lwp_info *lwp, int *wstat)
|
||||
{
|
||||
threads_debug_printf
|
||||
("Not requeuing already queued non-RT signal %d for LWP %ld",
|
||||
sig.signal, lwpid_of (thread));
|
||||
sig.signal, thread->id.lwp ());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2147,7 +2146,7 @@ enqueue_one_deferred_signal (struct lwp_info *lwp, int *wstat)
|
||||
|
||||
lwp->pending_signals_to_report.emplace_back (WSTOPSIG (*wstat));
|
||||
|
||||
ptrace (PTRACE_GETSIGINFO, lwpid_of (thread), (PTRACE_TYPE_ARG3) 0,
|
||||
ptrace (PTRACE_GETSIGINFO, thread->id.lwp (), (PTRACE_TYPE_ARG3) 0,
|
||||
&lwp->pending_signals_to_report.back ().info);
|
||||
}
|
||||
|
||||
@@ -2165,13 +2164,13 @@ dequeue_one_deferred_signal (struct lwp_info *lwp, int *wstat)
|
||||
|
||||
*wstat = W_STOPCODE (p_sig.signal);
|
||||
if (p_sig.info.si_signo != 0)
|
||||
ptrace (PTRACE_SETSIGINFO, lwpid_of (thread), (PTRACE_TYPE_ARG3) 0,
|
||||
ptrace (PTRACE_SETSIGINFO, thread->id.lwp (), (PTRACE_TYPE_ARG3) 0,
|
||||
&p_sig.info);
|
||||
|
||||
lwp->pending_signals_to_report.pop_front ();
|
||||
|
||||
threads_debug_printf ("Reporting deferred signal %d for LWP %ld.",
|
||||
WSTOPSIG (*wstat), lwpid_of (thread));
|
||||
WSTOPSIG (*wstat), thread->id.lwp ());
|
||||
|
||||
if (debug_threads)
|
||||
{
|
||||
@@ -2528,7 +2527,7 @@ linux_process_target::wait_for_event_filtered (ptid_t wait_ptid,
|
||||
if (event_thread != NULL)
|
||||
{
|
||||
event_child = get_thread_lwp (event_thread);
|
||||
threads_debug_printf ("Got a pending child %ld", lwpid_of (event_thread));
|
||||
threads_debug_printf ("Got a pending child %ld", event_thread->id.lwp ());
|
||||
}
|
||||
}
|
||||
else if (filter_ptid != null_ptid)
|
||||
@@ -2565,14 +2564,14 @@ linux_process_target::wait_for_event_filtered (ptid_t wait_ptid,
|
||||
if (event_child != NULL)
|
||||
{
|
||||
threads_debug_printf ("Got an event from pending child %ld (%04x)",
|
||||
lwpid_of (event_thread),
|
||||
event_thread->id.lwp (),
|
||||
event_child->status_pending);
|
||||
|
||||
*wstatp = event_child->status_pending;
|
||||
event_child->status_pending_p = 0;
|
||||
event_child->status_pending = 0;
|
||||
switch_to_thread (event_thread);
|
||||
return lwpid_of (event_thread);
|
||||
return event_thread->id.lwp ();
|
||||
}
|
||||
|
||||
/* But if we don't find a pending event, we'll have to wait.
|
||||
@@ -2696,7 +2695,7 @@ linux_process_target::wait_for_event_filtered (ptid_t wait_ptid,
|
||||
|
||||
switch_to_thread (event_thread);
|
||||
|
||||
return lwpid_of (event_thread);
|
||||
return event_thread->id.lwp ();
|
||||
}
|
||||
|
||||
int
|
||||
@@ -2818,7 +2817,7 @@ linux_process_target::stabilize_threads ()
|
||||
if (thread_stuck != NULL)
|
||||
{
|
||||
threads_debug_printf ("can't stabilize, LWP %ld is stuck in jump pad",
|
||||
lwpid_of (thread_stuck));
|
||||
thread_stuck->id.lwp ());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2874,7 +2873,7 @@ linux_process_target::stabilize_threads ()
|
||||
if (thread_stuck != NULL)
|
||||
threads_debug_printf
|
||||
("couldn't stabilize, LWP %ld got stuck in jump pad",
|
||||
lwpid_of (thread_stuck));
|
||||
thread_stuck->id.lwp ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3161,7 +3160,7 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
|
||||
{
|
||||
threads_debug_printf ("Got signal %d for LWP %ld. Check if we need "
|
||||
"to defer or adjust it.",
|
||||
WSTOPSIG (w), lwpid_of (current_thread));
|
||||
WSTOPSIG (w), current_thread->id.lwp ());
|
||||
|
||||
/* Allow debugging the jump pad itself. */
|
||||
if (current_thread->last_resume_kind != resume_step
|
||||
@@ -3170,7 +3169,7 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
|
||||
enqueue_one_deferred_signal (event_child, &w);
|
||||
|
||||
threads_debug_printf ("Signal %d for LWP %ld deferred (in jump pad)",
|
||||
WSTOPSIG (w), lwpid_of (current_thread));
|
||||
WSTOPSIG (w), current_thread->id.lwp ());
|
||||
|
||||
resume_one_lwp (event_child, 0, 0, NULL);
|
||||
|
||||
@@ -3184,7 +3183,7 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
|
||||
threads_debug_printf
|
||||
("LWP %ld was trying to move out of the jump pad (%d). "
|
||||
"Check if we're already there.",
|
||||
lwpid_of (current_thread),
|
||||
current_thread->id.lwp (),
|
||||
(int) event_child->collecting_fast_tracepoint);
|
||||
|
||||
trace_event = 1;
|
||||
@@ -3255,7 +3254,7 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
|
||||
&& !gdb_catch_this_syscall (event_child))
|
||||
{
|
||||
threads_debug_printf ("Ignored syscall for LWP %ld.",
|
||||
lwpid_of (current_thread));
|
||||
current_thread->id.lwp ());
|
||||
|
||||
resume_one_lwp (event_child, event_child->stepping, 0, NULL);
|
||||
|
||||
@@ -3287,9 +3286,9 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
|
||||
siginfo_t info, *info_p;
|
||||
|
||||
threads_debug_printf ("Ignored signal %d for LWP %ld.",
|
||||
WSTOPSIG (w), lwpid_of (current_thread));
|
||||
WSTOPSIG (w), current_thread->id.lwp ());
|
||||
|
||||
if (ptrace (PTRACE_GETSIGINFO, lwpid_of (current_thread),
|
||||
if (ptrace (PTRACE_GETSIGINFO, current_thread->id.lwp (),
|
||||
(PTRACE_TYPE_ARG3) 0, &info) == 0)
|
||||
info_p = &info;
|
||||
else
|
||||
@@ -3416,7 +3415,7 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
|
||||
{
|
||||
if (event_child->waitstatus.kind () != TARGET_WAITKIND_IGNORE)
|
||||
threads_debug_printf ("LWP %ld: extended event with waitstatus %s",
|
||||
lwpid_of (get_lwp_thread (event_child)),
|
||||
get_lwp_thread (event_child)->id.lwp (),
|
||||
event_child->waitstatus.to_string ().c_str ());
|
||||
|
||||
if (current_thread->last_resume_kind == resume_step)
|
||||
@@ -3696,9 +3695,7 @@ linux_stop_lwp (struct lwp_info *lwp)
|
||||
static void
|
||||
send_sigstop (struct lwp_info *lwp)
|
||||
{
|
||||
int pid;
|
||||
|
||||
pid = lwpid_of (get_lwp_thread (lwp));
|
||||
int pid = get_lwp_thread (lwp)->id.lwp ();
|
||||
|
||||
/* If we already have a pending stop signal for this process, don't
|
||||
send another. */
|
||||
@@ -3841,7 +3838,7 @@ linux_process_target::stuck_in_jump_pad (thread_info *thread)
|
||||
if (lwp->suspended != 0)
|
||||
{
|
||||
internal_error ("LWP %ld is suspended, suspended=%d\n",
|
||||
lwpid_of (thread), lwp->suspended);
|
||||
thread->id.lwp (), lwp->suspended);
|
||||
}
|
||||
gdb_assert (lwp->stopped);
|
||||
|
||||
@@ -3864,7 +3861,7 @@ linux_process_target::move_out_of_jump_pad (thread_info *thread)
|
||||
if (lwp->suspended != 0)
|
||||
{
|
||||
internal_error ("LWP %ld is suspended, suspended=%d\n",
|
||||
lwpid_of (thread), lwp->suspended);
|
||||
thread->id.lwp (), lwp->suspended);
|
||||
}
|
||||
gdb_assert (lwp->stopped);
|
||||
|
||||
@@ -3881,7 +3878,7 @@ linux_process_target::move_out_of_jump_pad (thread_info *thread)
|
||||
&& maybe_move_out_of_jump_pad (lwp, wstat))
|
||||
{
|
||||
threads_debug_printf ("LWP %ld needs stabilizing (in jump pad)",
|
||||
lwpid_of (thread));
|
||||
thread->id.lwp ());
|
||||
|
||||
if (wstat)
|
||||
{
|
||||
@@ -3889,7 +3886,7 @@ linux_process_target::move_out_of_jump_pad (thread_info *thread)
|
||||
enqueue_one_deferred_signal (lwp, wstat);
|
||||
|
||||
threads_debug_printf ("Signal %d for LWP %ld deferred (in jump pad",
|
||||
WSTOPSIG (*wstat), lwpid_of (thread));
|
||||
WSTOPSIG (*wstat), thread->id.lwp ());
|
||||
}
|
||||
|
||||
resume_one_lwp (lwp, 0, 0, NULL);
|
||||
@@ -4058,7 +4055,7 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step,
|
||||
{
|
||||
threads_debug_printf
|
||||
("Not resuming lwp %ld (%s, stop %s); has pending status",
|
||||
lwpid_of (thread), step ? "step" : "continue",
|
||||
thread->id.lwp (), step ? "step" : "continue",
|
||||
lwp->stop_expected ? "expected" : "not expected");
|
||||
return;
|
||||
}
|
||||
@@ -4099,13 +4096,13 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step,
|
||||
if (fast_tp_collecting == fast_tpoint_collect_result::before_insn)
|
||||
threads_debug_printf
|
||||
("lwp %ld wants to get out of fast tracepoint jump pad "
|
||||
"(exit-jump-pad-bkpt)", lwpid_of (thread));
|
||||
"(exit-jump-pad-bkpt)", thread->id.lwp ());
|
||||
|
||||
else if (fast_tp_collecting == fast_tpoint_collect_result::at_insn)
|
||||
{
|
||||
threads_debug_printf
|
||||
("lwp %ld wants to get out of fast tracepoint jump pad single-stepping",
|
||||
lwpid_of (thread));
|
||||
thread->id.lwp ());
|
||||
|
||||
if (supports_hardware_single_step ())
|
||||
step = 1;
|
||||
@@ -4128,7 +4125,7 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step,
|
||||
{
|
||||
threads_debug_printf
|
||||
("lwp %ld has a while-stepping action -> forcing step.",
|
||||
lwpid_of (thread));
|
||||
thread->id.lwp ());
|
||||
|
||||
step = single_step (lwp);
|
||||
}
|
||||
@@ -4151,14 +4148,14 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step,
|
||||
|
||||
signal = p_sig.signal;
|
||||
if (p_sig.info.si_signo != 0)
|
||||
ptrace (PTRACE_SETSIGINFO, lwpid_of (thread), (PTRACE_TYPE_ARG3) 0,
|
||||
ptrace (PTRACE_SETSIGINFO, thread->id.lwp (), (PTRACE_TYPE_ARG3) 0,
|
||||
&p_sig.info);
|
||||
|
||||
lwp->pending_signals.pop_front ();
|
||||
}
|
||||
|
||||
threads_debug_printf ("Resuming lwp %ld (%s, signal %d, stop %s)",
|
||||
lwpid_of (thread), step ? "step" : "continue", signal,
|
||||
thread->id.lwp (), step ? "step" : "continue", signal,
|
||||
lwp->stop_expected ? "expected" : "not expected");
|
||||
|
||||
low_prepare_to_resume (lwp);
|
||||
@@ -4173,7 +4170,7 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step,
|
||||
else
|
||||
ptrace_request = PTRACE_CONT;
|
||||
ptrace (ptrace_request,
|
||||
lwpid_of (thread),
|
||||
thread->id.lwp (),
|
||||
(PTRACE_TYPE_ARG3) 0,
|
||||
/* Coerce to a uintptr_t first to avoid potential gcc warning
|
||||
of coercing an 8 byte integer to a 4 byte pointer. */
|
||||
@@ -4230,7 +4227,7 @@ check_ptrace_stopped_lwp_gone (struct lwp_info *lp)
|
||||
other than ptrace-stopped. */
|
||||
|
||||
/* Don't assume anything if /proc/PID/status can't be read. */
|
||||
if (linux_proc_pid_is_trace_stopped_nowarn (lwpid_of (thread)) == 0)
|
||||
if (linux_proc_pid_is_trace_stopped_nowarn (thread->id.lwp ()) == 0)
|
||||
{
|
||||
lp->stop_reason = TARGET_STOPPED_BY_NO_REASON;
|
||||
lp->status_pending_p = 0;
|
||||
@@ -4293,7 +4290,7 @@ linux_set_resume_request (thread_info *thread, thread_resume *resume, size_t n)
|
||||
("already %s LWP %ld at GDB's request",
|
||||
(thread->last_status.kind () == TARGET_WAITKIND_STOPPED
|
||||
? "stopped" : "stopping"),
|
||||
lwpid_of (thread));
|
||||
thread->id.lwp ());
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -4307,7 +4304,7 @@ linux_set_resume_request (thread_info *thread, thread_resume *resume, size_t n)
|
||||
("already %s LWP %ld at GDB's request",
|
||||
(thread->last_resume_kind == resume_step
|
||||
? "stepping" : "continuing"),
|
||||
lwpid_of (thread));
|
||||
thread->id.lwp ());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -4322,7 +4319,7 @@ linux_set_resume_request (thread_info *thread, thread_resume *resume, size_t n)
|
||||
{
|
||||
threads_debug_printf
|
||||
("not resuming LWP %ld: has queued stop reply",
|
||||
lwpid_of (thread));
|
||||
thread->id.lwp ());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -4335,7 +4332,7 @@ linux_set_resume_request (thread_info *thread, thread_resume *resume, size_t n)
|
||||
{
|
||||
threads_debug_printf
|
||||
("not resuming LWP %ld: has queued stop reply",
|
||||
lwpid_of (thread));
|
||||
thread->id.lwp ());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -4358,7 +4355,7 @@ linux_set_resume_request (thread_info *thread, thread_resume *resume, size_t n)
|
||||
("Dequeueing deferred signal %d for LWP %ld, "
|
||||
"leaving status pending.",
|
||||
WSTOPSIG (lwp->status_pending),
|
||||
lwpid_of (thread));
|
||||
thread->id.lwp ());
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -4399,7 +4396,7 @@ linux_process_target::thread_needs_step_over (thread_info *thread)
|
||||
if (!lwp->stopped)
|
||||
{
|
||||
threads_debug_printf ("Need step over [LWP %ld]? Ignoring, not stopped",
|
||||
lwpid_of (thread));
|
||||
thread->id.lwp ());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -4407,7 +4404,7 @@ linux_process_target::thread_needs_step_over (thread_info *thread)
|
||||
{
|
||||
threads_debug_printf
|
||||
("Need step over [LWP %ld]? Ignoring, should remain stopped",
|
||||
lwpid_of (thread));
|
||||
thread->id.lwp ());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -4416,7 +4413,7 @@ linux_process_target::thread_needs_step_over (thread_info *thread)
|
||||
if (lwp->suspended)
|
||||
{
|
||||
threads_debug_printf ("Need step over [LWP %ld]? Ignoring, suspended",
|
||||
lwpid_of (thread));
|
||||
thread->id.lwp ());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -4424,7 +4421,7 @@ linux_process_target::thread_needs_step_over (thread_info *thread)
|
||||
{
|
||||
threads_debug_printf
|
||||
("Need step over [LWP %ld]? Ignoring, has pending status.",
|
||||
lwpid_of (thread));
|
||||
thread->id.lwp ());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -4441,7 +4438,7 @@ linux_process_target::thread_needs_step_over (thread_info *thread)
|
||||
{
|
||||
threads_debug_printf
|
||||
("Need step over [LWP %ld]? Cancelling, PC was changed. "
|
||||
"Old stop_pc was 0x%s, PC is now 0x%s", lwpid_of (thread),
|
||||
"Old stop_pc was 0x%s, PC is now 0x%s", thread->id.lwp (),
|
||||
paddress (lwp->stop_pc), paddress (pc));
|
||||
return false;
|
||||
}
|
||||
@@ -4454,7 +4451,7 @@ linux_process_target::thread_needs_step_over (thread_info *thread)
|
||||
{
|
||||
threads_debug_printf
|
||||
("Need step over [LWP %ld]? Ignoring, has pending signals.",
|
||||
lwpid_of (thread));
|
||||
thread->id.lwp ());
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -4474,7 +4471,7 @@ linux_process_target::thread_needs_step_over (thread_info *thread)
|
||||
{
|
||||
threads_debug_printf ("Need step over [LWP %ld]? yes, but found"
|
||||
" GDB breakpoint at 0x%s; skipping step over",
|
||||
lwpid_of (thread), paddress (pc));
|
||||
thread->id.lwp (), paddress (pc));
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -4482,7 +4479,7 @@ linux_process_target::thread_needs_step_over (thread_info *thread)
|
||||
{
|
||||
threads_debug_printf ("Need step over [LWP %ld]? yes, "
|
||||
"found breakpoint at 0x%s",
|
||||
lwpid_of (thread), paddress (pc));
|
||||
thread->id.lwp (), paddress (pc));
|
||||
|
||||
/* We've found an lwp that needs stepping over --- return 1 so
|
||||
that find_thread stops looking. */
|
||||
@@ -4492,7 +4489,7 @@ linux_process_target::thread_needs_step_over (thread_info *thread)
|
||||
|
||||
threads_debug_printf
|
||||
("Need step over [LWP %ld]? No, no breakpoint found at 0x%s",
|
||||
lwpid_of (thread), paddress (pc));
|
||||
thread->id.lwp (), paddress (pc));
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -4504,13 +4501,13 @@ linux_process_target::start_step_over (lwp_info *lwp)
|
||||
CORE_ADDR pc;
|
||||
|
||||
threads_debug_printf ("Starting step-over on LWP %ld. Stopping all threads",
|
||||
lwpid_of (thread));
|
||||
thread->id.lwp ());
|
||||
|
||||
stop_all_lwps (1, lwp);
|
||||
|
||||
if (lwp->suspended != 0)
|
||||
{
|
||||
internal_error ("LWP %ld suspended=%d\n", lwpid_of (thread),
|
||||
internal_error ("LWP %ld suspended=%d\n", thread->id.lwp (),
|
||||
lwp->suspended);
|
||||
}
|
||||
|
||||
@@ -4638,11 +4635,11 @@ linux_process_target::resume_one_thread (thread_info *thread,
|
||||
if (lwp->resume->kind == resume_stop)
|
||||
{
|
||||
threads_debug_printf ("resume_stop request for LWP %ld",
|
||||
lwpid_of (thread));
|
||||
thread->id.lwp ());
|
||||
|
||||
if (!lwp->stopped)
|
||||
{
|
||||
threads_debug_printf ("stopping LWP %ld", lwpid_of (thread));
|
||||
threads_debug_printf ("stopping LWP %ld", thread->id.lwp ());
|
||||
|
||||
/* Stop the thread, and wait for the event asynchronously,
|
||||
through the event loop. */
|
||||
@@ -4650,7 +4647,7 @@ linux_process_target::resume_one_thread (thread_info *thread,
|
||||
}
|
||||
else
|
||||
{
|
||||
threads_debug_printf ("already stopped LWP %ld", lwpid_of (thread));
|
||||
threads_debug_printf ("already stopped LWP %ld", thread->id.lwp ());
|
||||
|
||||
/* The LWP may have been stopped in an internal event that
|
||||
was not meant to be notified back to GDB (e.g., gdbserver
|
||||
@@ -4701,7 +4698,7 @@ linux_process_target::resume_one_thread (thread_info *thread,
|
||||
make sure to queue its siginfo. */
|
||||
if (WIFSTOPPED (lwp->last_status)
|
||||
&& WSTOPSIG (lwp->last_status) == lwp->resume->sig
|
||||
&& ptrace (PTRACE_GETSIGINFO, lwpid_of (thread),
|
||||
&& ptrace (PTRACE_GETSIGINFO, thread->id.lwp (),
|
||||
(PTRACE_TYPE_ARG3) 0, &info) == 0)
|
||||
info_p = &info;
|
||||
else
|
||||
@@ -4712,12 +4709,12 @@ linux_process_target::resume_one_thread (thread_info *thread,
|
||||
|
||||
if (!leave_pending)
|
||||
{
|
||||
threads_debug_printf ("resuming LWP %ld", lwpid_of (thread));
|
||||
threads_debug_printf ("resuming LWP %ld", thread->id.lwp ());
|
||||
|
||||
proceed_one_lwp (thread, NULL);
|
||||
}
|
||||
else
|
||||
threads_debug_printf ("leaving LWP %ld stopped", lwpid_of (thread));
|
||||
threads_debug_printf ("leaving LWP %ld stopped", thread->id.lwp ());
|
||||
|
||||
thread->last_status.set_ignore ();
|
||||
lwp->resume = NULL;
|
||||
@@ -4795,11 +4792,11 @@ linux_process_target::proceed_one_lwp (thread_info *thread, lwp_info *except)
|
||||
if (lwp == except)
|
||||
return;
|
||||
|
||||
threads_debug_printf ("lwp %ld", lwpid_of (thread));
|
||||
threads_debug_printf ("lwp %ld", thread->id.lwp ());
|
||||
|
||||
if (!lwp->stopped)
|
||||
{
|
||||
threads_debug_printf (" LWP %ld already running", lwpid_of (thread));
|
||||
threads_debug_printf (" LWP %ld already running", thread->id.lwp ());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4807,14 +4804,14 @@ linux_process_target::proceed_one_lwp (thread_info *thread, lwp_info *except)
|
||||
&& thread->last_status.kind () != TARGET_WAITKIND_IGNORE)
|
||||
{
|
||||
threads_debug_printf (" client wants LWP to remain %ld stopped",
|
||||
lwpid_of (thread));
|
||||
thread->id.lwp ());
|
||||
return;
|
||||
}
|
||||
|
||||
if (lwp->status_pending_p)
|
||||
{
|
||||
threads_debug_printf (" LWP %ld has pending status, leaving stopped",
|
||||
lwpid_of (thread));
|
||||
thread->id.lwp ());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4822,7 +4819,7 @@ linux_process_target::proceed_one_lwp (thread_info *thread, lwp_info *except)
|
||||
|
||||
if (lwp->suspended)
|
||||
{
|
||||
threads_debug_printf (" LWP %ld is suspended", lwpid_of (thread));
|
||||
threads_debug_printf (" LWP %ld is suspended", thread->id.lwp ());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4843,7 +4840,7 @@ linux_process_target::proceed_one_lwp (thread_info *thread, lwp_info *except)
|
||||
|
||||
threads_debug_printf
|
||||
("Client wants LWP %ld to stop. Making sure it has a SIGSTOP pending",
|
||||
lwpid_of (thread));
|
||||
thread->id.lwp ());
|
||||
|
||||
send_sigstop (lwp);
|
||||
}
|
||||
@@ -4851,7 +4848,7 @@ linux_process_target::proceed_one_lwp (thread_info *thread, lwp_info *except)
|
||||
if (thread->last_resume_kind == resume_step)
|
||||
{
|
||||
threads_debug_printf (" stepping LWP %ld, client wants it stepping",
|
||||
lwpid_of (thread));
|
||||
thread->id.lwp ());
|
||||
|
||||
/* If resume_step is requested by GDB, install single-step
|
||||
breakpoints when the thread is about to be actually resumed if
|
||||
@@ -4865,7 +4862,7 @@ linux_process_target::proceed_one_lwp (thread_info *thread, lwp_info *except)
|
||||
else if (lwp->bp_reinsert != 0)
|
||||
{
|
||||
threads_debug_printf (" stepping LWP %ld, reinsert set",
|
||||
lwpid_of (thread));
|
||||
thread->id.lwp ());
|
||||
|
||||
step = maybe_hw_step (thread);
|
||||
}
|
||||
@@ -4909,7 +4906,7 @@ linux_process_target::proceed_all_lwps ()
|
||||
if (need_step_over != NULL)
|
||||
{
|
||||
threads_debug_printf ("found thread %ld needing a step-over",
|
||||
lwpid_of (need_step_over));
|
||||
need_step_over->id.lwp ());
|
||||
|
||||
start_step_over (get_thread_lwp (need_step_over));
|
||||
return;
|
||||
@@ -4931,7 +4928,7 @@ linux_process_target::unstop_all_lwps (int unsuspend, lwp_info *except)
|
||||
|
||||
if (except)
|
||||
threads_debug_printf ("except=(LWP %ld)",
|
||||
lwpid_of (get_lwp_thread (except)));
|
||||
get_lwp_thread (except)->id.lwp ());
|
||||
else
|
||||
threads_debug_printf ("except=nullptr");
|
||||
|
||||
@@ -4980,10 +4977,9 @@ regsets_fetch_inferior_registers (struct regsets_info *regsets_info,
|
||||
{
|
||||
struct regset_info *regset;
|
||||
int saw_general_regs = 0;
|
||||
int pid;
|
||||
int pid = current_thread->id.lwp ();
|
||||
struct iovec iov;
|
||||
|
||||
pid = lwpid_of (current_thread);
|
||||
for (regset = regsets_info->regsets; regset->size >= 0; regset++)
|
||||
{
|
||||
void *buf, *data;
|
||||
@@ -5059,10 +5055,9 @@ regsets_store_inferior_registers (struct regsets_info *regsets_info,
|
||||
{
|
||||
struct regset_info *regset;
|
||||
int saw_general_regs = 0;
|
||||
int pid;
|
||||
int pid = current_thread->id.lwp ();
|
||||
struct iovec iov;
|
||||
|
||||
pid = lwpid_of (current_thread);
|
||||
for (regset = regsets_info->regsets; regset->size >= 0; regset++)
|
||||
{
|
||||
void *buf, *data;
|
||||
@@ -5187,7 +5182,6 @@ linux_process_target::fetch_register (const usrregs_info *usrregs,
|
||||
CORE_ADDR regaddr;
|
||||
int i, size;
|
||||
char *buf;
|
||||
int pid;
|
||||
|
||||
if (regno >= usrregs->num_regs)
|
||||
return;
|
||||
@@ -5203,7 +5197,8 @@ linux_process_target::fetch_register (const usrregs_info *usrregs,
|
||||
& -sizeof (PTRACE_XFER_TYPE));
|
||||
buf = (char *) alloca (size);
|
||||
|
||||
pid = lwpid_of (current_thread);
|
||||
int pid = current_thread->id.lwp ();
|
||||
|
||||
for (i = 0; i < size; i += sizeof (PTRACE_XFER_TYPE))
|
||||
{
|
||||
errno = 0;
|
||||
@@ -5231,7 +5226,6 @@ linux_process_target::store_register (const usrregs_info *usrregs,
|
||||
CORE_ADDR regaddr;
|
||||
int i, size;
|
||||
char *buf;
|
||||
int pid;
|
||||
|
||||
if (regno >= usrregs->num_regs)
|
||||
return;
|
||||
@@ -5250,7 +5244,8 @@ linux_process_target::store_register (const usrregs_info *usrregs,
|
||||
|
||||
low_collect_ptrace_register (regcache, regno, buf);
|
||||
|
||||
pid = lwpid_of (current_thread);
|
||||
int pid = current_thread->id.lwp ();
|
||||
|
||||
for (i = 0; i < size; i += sizeof (PTRACE_XFER_TYPE))
|
||||
{
|
||||
errno = 0;
|
||||
@@ -5680,7 +5675,7 @@ linux_process_target::read_offsets (CORE_ADDR *text_p, CORE_ADDR *data_p)
|
||||
{
|
||||
#ifdef SUPPORTS_READ_OFFSETS
|
||||
unsigned long text, text_end, data;
|
||||
int pid = lwpid_of (current_thread);
|
||||
int pid = current_thread->id.lwp ();
|
||||
|
||||
errno = 0;
|
||||
|
||||
@@ -5787,14 +5782,13 @@ linux_process_target::qxfer_siginfo (const char *annex,
|
||||
unsigned const char *writebuf,
|
||||
CORE_ADDR offset, int len)
|
||||
{
|
||||
int pid;
|
||||
siginfo_t siginfo;
|
||||
gdb_byte inf_siginfo[sizeof (siginfo_t)];
|
||||
|
||||
if (current_thread == NULL)
|
||||
return -1;
|
||||
|
||||
pid = lwpid_of (current_thread);
|
||||
int pid = current_thread->id.lwp ();
|
||||
|
||||
threads_debug_printf ("%s siginfo for lwp %d.",
|
||||
readbuf != NULL ? "Reading" : "Writing",
|
||||
@@ -5984,7 +5978,7 @@ linux_process_target::handle_new_gdb_connection ()
|
||||
struct process_info *proc = find_process_pid (pid_of (thread));
|
||||
int options = linux_low_ptrace_options (proc->attached);
|
||||
|
||||
linux_enable_event_reporting (lwpid_of (thread), options);
|
||||
linux_enable_event_reporting (thread->id.lwp (), options);
|
||||
lwp->must_set_ptrace_flags = 0;
|
||||
}
|
||||
});
|
||||
@@ -6123,7 +6117,7 @@ int
|
||||
linux_process_target::read_loadmap (const char *annex, CORE_ADDR offset,
|
||||
unsigned char *myaddr, unsigned int len)
|
||||
{
|
||||
int pid = lwpid_of (current_thread);
|
||||
int pid = current_thread->id.lwp ();
|
||||
int addr = -1;
|
||||
struct target_loadmap *data = NULL;
|
||||
unsigned int actual_length, copy_length;
|
||||
@@ -6626,7 +6620,7 @@ linux_process_target::qxfer_libraries_svr4 (const char *annex,
|
||||
{
|
||||
struct process_info_private *const priv = current_process ()->priv;
|
||||
char filename[PATH_MAX];
|
||||
int pid, is_elf64;
|
||||
int is_elf64;
|
||||
unsigned int machine;
|
||||
CORE_ADDR lmid = 0, lm_addr = 0, lm_prev = 0;
|
||||
|
||||
@@ -6635,7 +6629,7 @@ linux_process_target::qxfer_libraries_svr4 (const char *annex,
|
||||
if (readbuf == NULL)
|
||||
return -1;
|
||||
|
||||
pid = lwpid_of (current_thread);
|
||||
int pid = current_thread->id.lwp ();
|
||||
xsnprintf (filename, sizeof filename, "/proc/%d/exe", pid);
|
||||
is_elf64 = elf_64_file_p (filename, &machine);
|
||||
const link_map_offsets *lmo;
|
||||
|
||||
Reference in New Issue
Block a user