gdb: use ptid_t::to_string instead of target_pid_to_str in debug statements

Same idea as 0fab795564 ("gdb: use ptid_t::to_string in infrun debug
messages"), but throughout GDB.

Change-Id: I62ba36eaef29935316d7187b9b13d7b88491acc1
This commit is contained in:
Simon Marchi 2022-01-15 23:45:06 -05:00
parent cced7cacec
commit e53c95d40b
8 changed files with 71 additions and 71 deletions

View file

@ -1123,7 +1123,7 @@ attach_proc_task_lwp_callback (ptid_t ptid)
else
{
linux_nat_debug_printf ("PTRACE_ATTACH %s, 0, 0 (OK)",
target_pid_to_str (ptid).c_str ());
ptid.to_string ().c_str ());
lp = add_lwp (ptid);
@ -1356,18 +1356,18 @@ get_detach_signal (struct lwp_info *lp)
if (signo == GDB_SIGNAL_0)
{
linux_nat_debug_printf ("lwp %s has no pending signal",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
}
else if (!signal_pass_state (signo))
{
linux_nat_debug_printf
("lwp %s had signal %s but it is in no pass state",
target_pid_to_str (lp->ptid).c_str (), gdb_signal_to_string (signo));
lp->ptid.to_string ().c_str (), gdb_signal_to_string (signo));
}
else
{
linux_nat_debug_printf ("lwp %s has pending signal %s",
target_pid_to_str (lp->ptid).c_str (),
lp->ptid.to_string ().c_str (),
gdb_signal_to_string (signo));
return gdb_signal_to_host (signo);
@ -1433,13 +1433,13 @@ detach_one_lwp (struct lwp_info *lp, int *signo_p)
if (lp->status != 0)
linux_nat_debug_printf ("Pending %s for %s on detach.",
strsignal (WSTOPSIG (lp->status)),
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
/* If there is a pending SIGSTOP, get rid of it. */
if (lp->signalled)
{
linux_nat_debug_printf ("Sending SIGCONT to %s",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
kill_lwp (lwpid, SIGCONT);
lp->signalled = 0;
@ -1630,12 +1630,12 @@ resume_lwp (struct lwp_info *lp, int step, enum gdb_signal signo)
if (inf->vfork_child != NULL)
{
linux_nat_debug_printf ("Not resuming %s (vfork parent)",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
}
else if (!lwp_status_pending_p (lp))
{
linux_nat_debug_printf ("Resuming sibling %s, %s, %s",
target_pid_to_str (lp->ptid).c_str (),
lp->ptid.to_string ().c_str (),
(signo != GDB_SIGNAL_0
? strsignal (gdb_signal_to_host (signo))
: "0"),
@ -1646,12 +1646,12 @@ resume_lwp (struct lwp_info *lp, int step, enum gdb_signal signo)
else
{
linux_nat_debug_printf ("Not resuming sibling %s (has pending)",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
}
}
else
linux_nat_debug_printf ("Not resuming sibling %s (not stopped)",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
}
/* Callback for iterate_over_lwps. If LWP is EXCEPT, do nothing.
@ -1705,10 +1705,10 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
linux_nat_debug_printf ("Preparing to %s %s, %s, inferior_ptid %s",
step ? "step" : "resume",
target_pid_to_str (ptid).c_str (),
ptid.to_string ().c_str (),
(signo != GDB_SIGNAL_0
? strsignal (gdb_signal_to_host (signo)) : "0"),
target_pid_to_str (inferior_ptid).c_str ());
inferior_ptid.to_string ().c_str ());
/* A specific PTID means `step only this process id'. */
resume_many = (minus_one_ptid == ptid
@ -1780,7 +1780,7 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
linux_nat_debug_printf ("%s %s, %s (resume event thread)",
step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
target_pid_to_str (lp->ptid).c_str (),
lp->ptid.to_string ().c_str (),
(signo != GDB_SIGNAL_0
? strsignal (gdb_signal_to_host (signo)) : "0"));
@ -2167,7 +2167,7 @@ wait_lwp (struct lwp_info *lp)
the top of the file. */
thread_dead = 1;
linux_nat_debug_printf ("%s vanished.",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
}
if (pid != 0)
break;
@ -2191,7 +2191,7 @@ wait_lwp (struct lwp_info *lp)
{
thread_dead = 1;
linux_nat_debug_printf ("Thread group leader %s vanished.",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
break;
}
@ -2211,7 +2211,7 @@ wait_lwp (struct lwp_info *lp)
gdb_assert (pid == lp->ptid.lwp ());
linux_nat_debug_printf ("waitpid %s received %s",
target_pid_to_str (lp->ptid).c_str (),
lp->ptid.to_string ().c_str (),
status_to_str (status).c_str ());
/* Check if the thread has exited. */
@ -2232,7 +2232,7 @@ wait_lwp (struct lwp_info *lp)
thread_dead = 1;
linux_nat_debug_printf ("%s exited.",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
}
}
@ -2294,7 +2294,7 @@ stop_callback (struct lwp_info *lp)
int ret;
linux_nat_debug_printf ("kill %s **<SIGSTOP>**",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
errno = 0;
ret = kill_lwp (lp->ptid.lwp (), SIGSTOP);
@ -2388,7 +2388,7 @@ maybe_clear_ignore_sigint (struct lwp_info *lp)
if (!linux_nat_has_pending_sigint (lp->ptid.lwp ()))
{
linux_nat_debug_printf ("Clearing bogus flag for %s",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
lp->ignore_sigint = 0;
}
}
@ -2486,7 +2486,7 @@ stop_wait_callback (struct lwp_info *lp)
lp->stopped = 0;
linux_nat_debug_printf
("PTRACE_CONT %s, 0, 0 (%s) (discarding SIGINT)",
target_pid_to_str (lp->ptid).c_str (),
lp->ptid.to_string ().c_str (),
errno ? safe_strerror (errno) : "OK");
return stop_wait_callback (lp);
@ -2500,7 +2500,7 @@ stop_wait_callback (struct lwp_info *lp)
linux_nat_debug_printf ("Pending event %s in %s",
status_to_str ((int) status).c_str (),
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
/* Save the sigtrap event. */
lp->status = status;
@ -2512,7 +2512,7 @@ stop_wait_callback (struct lwp_info *lp)
/* We caught the SIGSTOP that we intended to catch. */
linux_nat_debug_printf ("Expected SIGSTOP caught for %s.",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
lp->signalled = 0;
@ -2557,7 +2557,7 @@ status_callback (struct lwp_info *lp)
if (pc != lp->stop_pc)
{
linux_nat_debug_printf ("PC of %s changed. was=%s, now=%s",
target_pid_to_str (lp->ptid).c_str (),
lp->ptid.to_string ().c_str (),
paddress (target_gdbarch (), lp->stop_pc),
paddress (target_gdbarch (), pc));
discard = 1;
@ -2567,7 +2567,7 @@ status_callback (struct lwp_info *lp)
else if (!breakpoint_inserted_here_p (regcache->aspace (), pc))
{
linux_nat_debug_printf ("previous breakpoint of %s, at %s gone",
target_pid_to_str (lp->ptid).c_str (),
lp->ptid.to_string ().c_str (),
paddress (target_gdbarch (), lp->stop_pc));
discard = 1;
@ -2577,7 +2577,7 @@ status_callback (struct lwp_info *lp)
if (discard)
{
linux_nat_debug_printf ("pending event of %s cancelled.",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
lp->status = 0;
linux_resume_one_lwp (lp, lp->step, GDB_SIGNAL_0);
@ -2701,7 +2701,7 @@ save_stop_reason (struct lwp_info *lp)
else if (siginfo.si_code == TRAP_TRACE)
{
linux_nat_debug_printf ("%s stopped by trace",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
/* We may have single stepped an instruction that
triggered a watchpoint. In that case, on some
@ -2732,7 +2732,7 @@ save_stop_reason (struct lwp_info *lp)
if (lp->stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT)
{
linux_nat_debug_printf ("%s stopped by software breakpoint",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
/* Back up the PC if necessary. */
if (pc != sw_bp_pc)
@ -2744,12 +2744,12 @@ save_stop_reason (struct lwp_info *lp)
else if (lp->stop_reason == TARGET_STOPPED_BY_HW_BREAKPOINT)
{
linux_nat_debug_printf ("%s stopped by hardware breakpoint",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
}
else if (lp->stop_reason == TARGET_STOPPED_BY_WATCHPOINT)
{
linux_nat_debug_printf ("%s stopped by hardware watchpoint",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
}
lp->stop_pc = pc;
@ -2824,7 +2824,7 @@ select_event_lwp (ptid_t filter, struct lwp_info **orig_lp, int *status)
if (event_lp != NULL)
{
linux_nat_debug_printf ("Select single-step %s",
target_pid_to_str (event_lp->ptid).c_str ());
event_lp->ptid.to_string ().c_str ());
}
}
@ -2978,7 +2978,7 @@ linux_nat_filter_event (int lwpid, int status)
&& num_lwps (lp->ptid.pid ()) > 1)
{
linux_nat_debug_printf ("%s exited.",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
/* If there is at least one more LWP, then the exit signal
was not the end of the debugged application and should be
@ -3013,7 +3013,7 @@ linux_nat_filter_event (int lwpid, int status)
if (lp->last_resume_kind == resume_stop)
{
linux_nat_debug_printf ("resume_stop SIGSTOP caught for %s.",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
}
else
{
@ -3022,7 +3022,7 @@ linux_nat_filter_event (int lwpid, int status)
linux_nat_debug_printf
("%s %s, 0, 0 (discard delayed SIGSTOP)",
lp->step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
linux_resume_one_lwp (lp, lp->step, GDB_SIGNAL_0);
gdb_assert (lp->resumed);
@ -3036,7 +3036,7 @@ linux_nat_filter_event (int lwpid, int status)
&& WIFSTOPPED (status) && WSTOPSIG (status) == SIGINT)
{
linux_nat_debug_printf ("Delayed SIGINT caught for %s.",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
/* This is a delayed SIGINT. */
lp->ignore_sigint = 0;
@ -3044,7 +3044,7 @@ linux_nat_filter_event (int lwpid, int status)
linux_resume_one_lwp (lp, lp->step, GDB_SIGNAL_0);
linux_nat_debug_printf ("%s %s, 0, 0 (discard SIGINT)",
lp->step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
gdb_assert (lp->resumed);
/* Discard the event. */
@ -3094,7 +3094,7 @@ linux_nat_filter_event (int lwpid, int status)
linux_nat_debug_printf
("%s %s, %s (preempt 'handle')",
lp->step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
target_pid_to_str (lp->ptid).c_str (),
lp->ptid.to_string ().c_str (),
(signo != GDB_SIGNAL_0
? strsignal (gdb_signal_to_host (signo)) : "0"));
return;
@ -3212,7 +3212,7 @@ linux_nat_wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus,
{
linux_nat_debug_printf ("Using pending wait status %s for %s.",
status_to_str (lp->status).c_str (),
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
}
/* But if we don't find a pending event, we'll have to wait. Always
@ -3364,7 +3364,7 @@ linux_nat_wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus,
if (linux_target->low_status_is_event (status))
{
linux_nat_debug_printf ("trap ptid is %s.",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
}
if (lp->waitstatus.kind () != TARGET_WAITKIND_IGNORE)
@ -3410,17 +3410,17 @@ resume_stopped_resumed_lwps (struct lwp_info *lp, const ptid_t wait_ptid)
if (!lp->stopped)
{
linux_nat_debug_printf ("NOT resuming LWP %s, not stopped",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
}
else if (!lp->resumed)
{
linux_nat_debug_printf ("NOT resuming LWP %s, not resumed",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
}
else if (lwp_status_pending_p (lp))
{
linux_nat_debug_printf ("NOT resuming LWP %s, has pending status",
target_pid_to_str (lp->ptid).c_str ());
lp->ptid.to_string ().c_str ());
}
else
{
@ -3444,7 +3444,7 @@ resume_stopped_resumed_lwps (struct lwp_info *lp, const ptid_t wait_ptid)
{
linux_nat_debug_printf
("resuming stopped-resumed LWP %s at %s: step=%d",
target_pid_to_str (lp->ptid).c_str (), paddress (gdbarch, pc),
lp->ptid.to_string ().c_str (), paddress (gdbarch, pc),
lp->step);
linux_resume_one_lwp_throw (lp, lp->step, GDB_SIGNAL_0);
@ -3466,7 +3466,7 @@ linux_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
{
ptid_t event_ptid;
linux_nat_debug_printf ("[%s], [%s]", target_pid_to_str (ptid).c_str (),
linux_nat_debug_printf ("[%s], [%s]", ptid.to_string ().c_str (),
target_options_to_string (target_options).c_str ());
/* Flush the async file first. */
@ -4295,7 +4295,7 @@ linux_nat_stop_lwp (struct lwp_info *lwp)
if (!lwp->stopped)
{
linux_nat_debug_printf ("running -> suspending %s",
target_pid_to_str (lwp->ptid).c_str ());
lwp->ptid.to_string ().c_str ());
if (lwp->last_resume_kind == resume_stop)
@ -4316,10 +4316,10 @@ linux_nat_stop_lwp (struct lwp_info *lwp)
{
if (find_thread_ptid (linux_target, lwp->ptid)->stop_requested)
linux_nat_debug_printf ("already stopped/stop_requested %s",
target_pid_to_str (lwp->ptid).c_str ());
lwp->ptid.to_string ().c_str ());
else
linux_nat_debug_printf ("already stopped/no stop_requested yet %s",
target_pid_to_str (lwp->ptid).c_str ());
lwp->ptid.to_string ().c_str ());
}
}
return 0;