/* Multi-process/thread control for GDB, the GNU debugger.
- Copyright (C) 1986-2021 Free Software Foundation, Inc.
+ Copyright (C) 1986-2022 Free Software Foundation, Inc.
Contributed by Lynx Real-Time Systems, Inc. Los Gatos, CA.
#include "annotate.h"
#include "cli/cli-decode.h"
#include "cli/cli-option.h"
-#include "gdb_regex.h"
+#include "gdbsupport/gdb_regex.h"
#include "cli/cli-utils.h"
#include "thread-fsm.h"
#include "tid-parse.h"
void
thread_cancel_execution_command (struct thread_info *thr)
{
- if (thr->thread_fsm != NULL)
+ if (thr->thread_fsm () != nullptr)
{
- thr->thread_fsm->clean_up (thr);
- delete thr->thread_fsm;
- thr->thread_fsm = NULL;
+ std::unique_ptr<thread_fsm> fsm = thr->release_thread_fsm ();
+ fsm->clean_up (thr);
}
}
global_thread_step_over_chain_enqueue (struct thread_info *tp)
{
infrun_debug_printf ("enqueueing thread %s in global step over chain",
- target_pid_to_str (tp->ptid).c_str ());
+ tp->ptid.to_string ().c_str ());
gdb_assert (!thread_is_in_step_over_chain (tp));
global_thread_step_over_list.push_back (*tp);
global_thread_step_over_chain_remove (struct thread_info *tp)
{
infrun_debug_printf ("removing thread %s from global step over chain",
- target_pid_to_str (tp->ptid).c_str ());
+ tp->ptid.to_string ().c_str ());
gdb_assert (thread_is_in_step_over_chain (tp));
auto it = global_thread_step_over_list.iterator_to (*tp);
return target_thread_name (thread);
}
+/* See gdbthread.h. */
+
+const char *
+thread_state_string (enum thread_state state)
+{
+ switch (state)
+ {
+ case THREAD_STOPPED:
+ return "STOPPED";
+
+ case THREAD_RUNNING:
+ return "RUNNING";
+
+ case THREAD_EXITED:
+ return "EXITED";
+ }
+
+ gdb_assert_not_reached ("unknown thread state");
+}
+
/* Return a new value for the selected thread's id. Return a value of
0 if no thread is selected. If GLOBAL is true, return the thread's
global number. Otherwise return the per-inferior number. */