struct thread_info *thr = get_lwp_thread (lwp);
debug_printf ("CSBB: %s stopped by software breakpoint\n",
- target_pid_to_str (ptid_of (thr)));
+ target_pid_to_str (ptid_of (thr)).c_str ());
}
/* Back up the PC if necessary. */
struct thread_info *thr = get_lwp_thread (lwp);
debug_printf ("CSBB: %s stopped by hardware breakpoint\n",
- target_pid_to_str (ptid_of (thr)));
+ target_pid_to_str (ptid_of (thr)).c_str ());
}
}
else if (lwp->stop_reason == TARGET_STOPPED_BY_WATCHPOINT)
struct thread_info *thr = get_lwp_thread (lwp);
debug_printf ("CSBB: %s stopped by hardware watchpoint\n",
- target_pid_to_str (ptid_of (thr)));
+ target_pid_to_str (ptid_of (thr)).c_str ());
}
}
else if (lwp->stop_reason == TARGET_STOPPED_BY_SINGLE_STEP)
struct thread_info *thr = get_lwp_thread (lwp);
debug_printf ("CSBB: %s stopped by trace\n",
- target_pid_to_str (ptid_of (thr)));
+ target_pid_to_str (ptid_of (thr)).c_str ());
}
}
int save_errno = errno;
debug_printf ("LKL: kill_lwp (SIGKILL) %s, 0, 0 (%s)\n",
- target_pid_to_str (ptid_of (thr)),
+ target_pid_to_str (ptid_of (thr)).c_str (),
save_errno ? safe_strerror (save_errno) : "OK");
}
int save_errno = errno;
debug_printf ("LKL: PTRACE_KILL %s, 0, 0 (%s)\n",
- target_pid_to_str (ptid_of (thr)),
+ target_pid_to_str (ptid_of (thr)).c_str (),
save_errno ? safe_strerror (save_errno) : "OK");
}
}
{
if (debug_threads)
debug_printf ("lkop: is last of process %s\n",
- target_pid_to_str (thread->id));
+ target_pid_to_str (thread->id).c_str ());
return;
}
{
if (debug_threads)
debug_printf ("GPS: lwp %s hasn't stopped: no pending signal\n",
- target_pid_to_str (ptid_of (thread)));
+ target_pid_to_str (ptid_of (thread)).c_str ());
return 0;
}
if (debug_threads)
debug_printf ("GPS: lwp %s had stopped with extended "
"status: no pending signal\n",
- target_pid_to_str (ptid_of (thread)));
+ target_pid_to_str (ptid_of (thread)).c_str ());
return 0;
}
{
if (debug_threads)
debug_printf ("GPS: lwp %s had signal %s, but it is in nopass state\n",
- target_pid_to_str (ptid_of (thread)),
+ target_pid_to_str (ptid_of (thread)).c_str (),
gdb_signal_to_string (signo));
return 0;
}
debug_printf ("GPS: lwp %s had signal %s, "
"but we don't know if we should pass it. "
"Default to not.\n",
- target_pid_to_str (ptid_of (thread)),
+ target_pid_to_str (ptid_of (thread)).c_str (),
gdb_signal_to_string (signo));
return 0;
}
{
if (debug_threads)
debug_printf ("GPS: lwp %s has pending signal %s: delivering it.\n",
- target_pid_to_str (ptid_of (thread)),
+ target_pid_to_str (ptid_of (thread)).c_str (),
gdb_signal_to_string (signo));
return WSTOPSIG (status);
{
if (debug_threads)
debug_printf ("Sending SIGCONT to %s\n",
- target_pid_to_str (ptid_of (thread)));
+ target_pid_to_str (ptid_of (thread)).c_str ());
kill_lwp (lwpid_of (thread), SIGCONT);
lwp->stop_expected = 0;
else
{
error (_("Can't detach %s: %s"),
- target_pid_to_str (ptid_of (thread)),
+ target_pid_to_str (ptid_of (thread)).c_str (),
safe_strerror (save_errno));
}
}
else if (debug_threads)
{
debug_printf ("PTRACE_DETACH (%s, %s, 0) (OK)\n",
- target_pid_to_str (ptid_of (thread)),
+ target_pid_to_str (ptid_of (thread)).c_str (),
strsignal (sig));
}
SIGSTOP as a normal event. */
if (debug_threads)
debug_printf ("LLW: resume_stop SIGSTOP caught for %s.\n",
- target_pid_to_str (ptid_of (thread)));
+ target_pid_to_str (ptid_of (thread)).c_str ());
}
else if (stopping_threads != NOT_STOPPING_THREADS)
{
if (debug_threads)
debug_printf ("LLW: SIGSTOP caught for %s "
"while stopping threads.\n",
- target_pid_to_str (ptid_of (thread)));
+ target_pid_to_str (ptid_of (thread)).c_str ());
return;
}
else
if (debug_threads)
debug_printf ("LLW: %s %s, 0, 0 (discard delayed SIGSTOP)\n",
child->stepping ? "step" : "continue",
- target_pid_to_str (ptid_of (thread)));
+ target_pid_to_str (ptid_of (thread)).c_str ());
resume_one_lwp (child, child->stepping, 0, NULL);
return;
if (debug_threads)
debug_printf ("RSRL: resuming stopped-resumed LWP %s at %s: step=%d\n",
- target_pid_to_str (ptid_of (thread)),
+ target_pid_to_str (ptid_of (thread)).c_str (),
paddress (lp->stop_pc),
step);
{
if (debug_threads)
debug_printf ("SEL: Select single-step %s\n",
- target_pid_to_str (ptid_of (event_thread)));
+ target_pid_to_str (ptid_of (event_thread)).c_str ());
}
}
if (event_thread == NULL)
if (debug_threads)
{
debug_enter ();
- debug_printf ("wait_1: [%s]\n", target_pid_to_str (ptid));
+ debug_printf ("wait_1: [%s]\n", target_pid_to_str (ptid).c_str ());
}
/* Translate generic target options into linux options. */
{
if (debug_threads)
debug_printf ("step_over_bkpt set [%s], doing a blocking wait\n",
- target_pid_to_str (step_over_bkpt));
+ target_pid_to_str (step_over_bkpt).c_str ());
pid = wait_for_event (step_over_bkpt, &w, options & ~WNOHANG);
}
{
debug_printf ("wait_1 ret = %s, exited with "
"retcode %d\n",
- target_pid_to_str (ptid_of (current_thread)),
+ target_pid_to_str (ptid_of (current_thread)).c_str (),
WEXITSTATUS (w));
debug_exit ();
}
{
debug_printf ("wait_1 ret = %s, terminated with "
"signal %d\n",
- target_pid_to_str (ptid_of (current_thread)),
+ target_pid_to_str (ptid_of (current_thread)).c_str (),
WTERMSIG (w));
debug_exit ();
}
if (debug_threads)
{
debug_printf ("step-over for %s executed software breakpoint\n",
- target_pid_to_str (ptid_of (current_thread)));
+ target_pid_to_str (ptid_of (current_thread)).c_str ());
}
if (increment_pc != 0)
{
debug_printf ("wait_1 ret = %s, stopped "
"while stabilizing threads\n",
- target_pid_to_str (ptid_of (current_thread)));
+ target_pid_to_str
+ (ptid_of (current_thread)).c_str ());
debug_exit ();
}
if (debug_threads)
{
debug_printf ("wait_1 ret = %s, %d, %d\n",
- target_pid_to_str (ptid_of (current_thread)),
+ target_pid_to_str (ptid_of (current_thread)).c_str (),
ourstatus->kind (), ourstatus->sig ());
debug_exit ();
}
debug_enter ();
debug_printf ("stop_all_lwps (%s, except=%s)\n",
suspend ? "stop-and-suspend" : "stop",
- except != NULL
- ? target_pid_to_str (ptid_of (get_lwp_thread (except)))
- : "none");
+ (except != NULL
+ ? target_pid_to_str
+ (ptid_of (get_lwp_thread (except))).c_str ()
+ : "none"));
}
stopping_threads = (suspend
/* Convert pid to printable format. */
-const char *
+std::string
target_pid_to_str (ptid_t ptid)
{
- static char buf[80];
-
if (ptid == minus_one_ptid)
- xsnprintf (buf, sizeof (buf), "<all threads>");
+ return string_printf("<all threads>");
else if (ptid == null_ptid)
- xsnprintf (buf, sizeof (buf), "<null thread>");
+ return string_printf("<null thread>");
else if (ptid.tid () != 0)
- xsnprintf (buf, sizeof (buf), "Thread %d.0x%s",
- ptid.pid (), phex_nz (ptid.tid (), sizeof (ULONGEST)));
+ return string_printf("Thread %d.0x%s",
+ ptid.pid (),
+ phex_nz (ptid.tid (), sizeof (ULONGEST)));
else if (ptid.lwp () != 0)
- xsnprintf (buf, sizeof (buf), "LWP %d.%ld",
- ptid.pid (), ptid.lwp ());
+ return string_printf("LWP %d.%ld",
+ ptid.pid (), ptid.lwp ());
else
- xsnprintf (buf, sizeof (buf), "Process %d",
- ptid.pid ());
-
- return buf;
+ return string_printf("Process %d",
+ ptid.pid ());
}
int
wstep_link = &tinfo->while_stepping;
trace_debug ("Thread %s finished a single-step for tracepoint %d at 0x%s",
- target_pid_to_str (tinfo->id),
+ target_pid_to_str (tinfo->id).c_str (),
wstep->tp_number, paddress (wstep->tp_address));
ctx.base.type = trap_tracepoint;
{
trace_debug ("NO TRACEPOINT %d at 0x%s FOR THREAD %s!",
wstep->tp_number, paddress (wstep->tp_address),
- target_pid_to_str (tinfo->id));
+ target_pid_to_str (tinfo->id).c_str ());
/* Unlink. */
*wstep_link = wstep->next;
{
/* The requested numbers of steps have occurred. */
trace_debug ("Thread %s done stepping for tracepoint %d at 0x%s",
- target_pid_to_str (tinfo->id),
+ target_pid_to_str (tinfo->id).c_str (),
wstep->tp_number, paddress (wstep->tp_address));
/* Unlink the wstep. */
&& tpoint->type != static_tracepoint)
{
trace_debug ("Thread %s at address of tracepoint %d at 0x%s",
- target_pid_to_str (tinfo->id),
+ target_pid_to_str (tinfo->id).c_str (),
tpoint->number, paddress (tpoint->address));
/* Test the condition if present, and collect if true. */