inf_debug (inf, "returning ptid = %s, %s",
target_pid_to_str (ptid).c_str (),
- target_waitstatus_to_string (status).c_str ());
+ status->to_string ().c_str ());
return ptid;
}
("thread %s has pending wait "
"status %s (currently_stepping=%d).",
tp->ptid.to_string ().c_str (),
- target_waitstatus_to_string (&tp->pending_waitstatus ()).c_str (),
+ tp->pending_waitstatus ().to_string ().c_str (),
currently_stepping (tp));
tp->inf->process_target ()->threads_executing = true;
infrun_debug_printf
("thread %s has pending wait status %s (currently_stepping=%d).",
tp->ptid.to_string ().c_str (),
- target_waitstatus_to_string (&tp->pending_waitstatus ()).c_str (),
+ tp->pending_waitstatus ().to_string ().c_str (),
currently_stepping (tp));
}
}
infrun_debug_printf (" %s [%s],",
result_ptid.to_string ().c_str (),
target_pid_to_str (result_ptid).c_str ());
- infrun_debug_printf (" %s", target_waitstatus_to_string (ws).c_str ());
+ infrun_debug_printf (" %s", ws->to_string ().c_str ());
}
/* Select a thread at random, out of those which are resumed and have
if (tp != NULL)
{
infrun_debug_printf ("Using pending wait status %s for %s.",
- target_waitstatus_to_string
- (&tp->pending_waitstatus ()).c_str (),
+ tp->pending_waitstatus ().to_string ().c_str (),
tp->ptid.to_string ().c_str ());
/* Now that we've selected our final event LWP, un-adjust its PC
save_waitstatus (struct thread_info *tp, const target_waitstatus *ws)
{
infrun_debug_printf ("saving status %s for %s",
- target_waitstatus_to_string (ws).c_str (),
+ ws->to_string ().c_str (),
tp->ptid.to_string ().c_str ());
/* Record for later. */
handle_one (const wait_one_event &event)
{
infrun_debug_printf
- ("%s %s", target_waitstatus_to_string (&event.ws).c_str (),
+ ("%s %s", event.ws.to_string ().c_str (),
event.ptid.to_string ().c_str ());
if (event.ws.kind () == TARGET_WAITKIND_NO_RESUMED)
infrun_debug_printf
("target_wait %s, saving status for %s",
- target_waitstatus_to_string (&event.ws).c_str (),
+ event.ws.to_string ().c_str (),
t->ptid.to_string ().c_str ());
/* Record for later. */
end. */
scoped_value_mark free_values;
- infrun_debug_printf ("%s", target_waitstatus_to_string (&ecs->ws).c_str ());
+ infrun_debug_printf ("%s", ecs->ws.to_string ().c_str ());
if (ecs->ws.kind () == TARGET_WAITKIND_IGNORE)
{
*status = btrace_step_no_resumed ();
DEBUG ("wait ended by %s: %s", target_pid_to_str (null_ptid).c_str (),
- target_waitstatus_to_string (status).c_str ());
+ status->to_string ().c_str ());
return null_ptid;
}
DEBUG ("wait ended by thread %s (%s): %s",
print_thread_id (eventing),
target_pid_to_str (eventing->ptid).c_str (),
- target_waitstatus_to_string (status).c_str ());
+ status->to_string ().c_str ());
return eventing->ptid;
}
static void
target_debug_print_struct_target_waitstatus_p (struct target_waitstatus *status)
{
- std::string str = target_waitstatus_to_string (status);
-
- fputs_unfiltered (str.c_str (), gdb_stdlog);
+ fputs_unfiltered (status->to_string ().c_str (), gdb_stdlog);
}
\f
/* Return a pretty printed form of target_waitstatus. */
std::string
-target_waitstatus_to_string (const struct target_waitstatus *ws)
+target_waitstatus::to_string () const
{
const char *kind_str = "status->kind = ";
- switch (ws->kind ())
+ switch (this->kind ())
{
case TARGET_WAITKIND_EXITED:
return string_printf ("%sexited, status = %d",
- kind_str, ws->exit_status ());
+ kind_str, this->exit_status ());
case TARGET_WAITKIND_STOPPED:
return string_printf ("%sstopped, signal = %s",
kind_str,
- gdb_signal_to_symbol_string (ws->sig ()));
+ gdb_signal_to_symbol_string (this->sig ()));
case TARGET_WAITKIND_SIGNALLED:
return string_printf ("%ssignalled, signal = %s",
kind_str,
- gdb_signal_to_symbol_string (ws->sig ()));
+ gdb_signal_to_symbol_string (this->sig ()));
case TARGET_WAITKIND_LOADED:
return string_printf ("%sloaded", kind_str);
case TARGET_WAITKIND_FORKED:
return string_printf ("%sforked, child_ptid = %s", kind_str,
- ws->child_ptid ().to_string ().c_str ());
+ this->child_ptid ().to_string ().c_str ());
case TARGET_WAITKIND_VFORKED:
return string_printf ("%svforked, child_ptid = %s", kind_str,
- ws->child_ptid ().to_string ().c_str ());
+ this->child_ptid ().to_string ().c_str ());
case TARGET_WAITKIND_EXECD:
return string_printf ("%sexecd, execd_pathname = %s", kind_str,
- ws->execd_pathname ());
+ this->execd_pathname ());
case TARGET_WAITKIND_VFORK_DONE:
return string_printf ("%svfork-done", kind_str);
case TARGET_WAITKIND_THREAD_EXITED:
return string_printf ("%sthread exited, status = %d",
- kind_str, ws->exit_status ());
+ kind_str, this->exit_status ());
default:
return string_printf ("%sunknown???", kind_str);
return m_value.syscall_number;
}
+ /* Return a pretty printed form of target_waitstatus.
+
+ This is only meant to be used in debug messages, not for user-visible
+ messages. */
+ std::string to_string () const;
+
private:
/* Reset the wait status to its original state. */
void reset ()
TARGET_STOPPED_BY_SINGLE_STEP
};
-/* Prototypes */
-
-/* Return a pretty printed form of target_waitstatus. */
-std::string target_waitstatus_to_string (const struct target_waitstatus *);
-
#endif /* TARGET_WAITSTATUS_H */
if (debug_threads)
{
if (event_child->waitstatus.kind () != TARGET_WAITKIND_IGNORE)
- {
- std::string str
- = target_waitstatus_to_string (&event_child->waitstatus);
-
- debug_printf ("LWP %ld: extended event with waitstatus %s\n",
- lwpid_of (get_lwp_thread (event_child)), str.c_str ());
- }
+ debug_printf ("LWP %ld: extended event with waitstatus %s\n",
+ lwpid_of (get_lwp_thread (event_child)),
+ event_child->waitstatus.to_string ().c_str ());
if (current_thread->last_resume_kind == resume_step)
{
if (event_child->step_range_start == event_child->step_range_end)
if (target_thread_stopped (thread))
{
if (debug_threads)
- {
- std::string status_string
- = target_waitstatus_to_string (&thread->last_status);
-
- debug_printf ("Reporting thread %s as already stopped with %s\n",
- target_pid_to_str (thread->id).c_str (),
- status_string.c_str ());
- }
+ debug_printf ("Reporting thread %s as already stopped with %s\n",
+ target_pid_to_str (thread->id).c_str (),
+ thread->last_status.to_string ().c_str ());
gdb_assert (thread->last_status.kind () != TARGET_WAITKIND_IGNORE);