#include "cli/cli-decode.h"
#include "gdb_regex.h"
#include "cli/cli-utils.h"
-#include "continuations.h"
+#include "thread-fsm.h"
/* Definition of struct thread_info exported to gdbthread.h. */
&& breakpoint_has_location_inserted_here (ss_bps, aspace, addr));
}
+/* See gdbthread.h. */
+
+void
+thread_cancel_execution_command (struct thread_info *thr)
+{
+ if (thr->thread_fsm != NULL)
+ {
+ thread_fsm_clean_up (thr->thread_fsm);
+ thread_fsm_delete (thr->thread_fsm);
+ thr->thread_fsm = NULL;
+ }
+}
+
static void
clear_thread_inferior_resources (struct thread_info *tp)
{
btrace_teardown (tp);
- do_all_intermediate_continuations_thread (tp, 1);
- do_all_continuations_thread (tp, 1);
+ thread_cancel_execution_command (tp);
}
static void
static struct thread_info *
new_thread (ptid_t ptid)
{
- struct thread_info *tp;
-
- tp = xcalloc (1, sizeof (*tp));
+ struct thread_info *tp = XCNEW (struct thread_info);
tp->ptid = ptid;
tp->num = ++highest_thread_num;
/* Nothing to follow yet. */
tp->pending_follow.kind = TARGET_WAITKIND_SPURIOUS;
tp->state = THREAD_STOPPED;
+ tp->suspend.waitstatus.kind = TARGET_WAITKIND_IGNORE;
return tp;
}
tp->stack_temporaries_enabled = 1;
tp->stack_temporaries = NULL;
- data = (ptid_t *) xmalloc (sizeof (ptid_t));
+ data = XNEW (ptid_t);
*data = ptid;
c = make_cleanup (disable_thread_stack_temporaries, data);
observer_notify_thread_ptid_changed (old_ptid, new_ptid);
}
+/* See gdbthread.h. */
+
+void
+set_resumed (ptid_t ptid, int resumed)
+{
+ struct thread_info *tp;
+ int all = ptid_equal (ptid, minus_one_ptid);
+
+ if (all || ptid_is_pid (ptid))
+ {
+ for (tp = thread_list; tp; tp = tp->next)
+ if (all || ptid_get_pid (tp->ptid) == ptid_get_pid (ptid))
+ tp->resumed = resumed;
+ }
+ else
+ {
+ tp = find_thread_ptid (ptid);
+ gdb_assert (tp != NULL);
+ tp->resumed = resumed;
+ }
+}
+
/* Helper for set_running, that marks one thread either running or
stopped. */
{
struct thread_info *tp;
struct frame_info *frame;
- struct current_thread_cleanup *old;
+ struct current_thread_cleanup *old = XNEW (struct current_thread_cleanup);
- old = xmalloc (sizeof (struct current_thread_cleanup));
old->inferior_ptid = inferior_ptid;
old->inf_id = current_inferior ()->num;
old->was_removable = current_inferior ()->removable;
/* Save a copy of the thread_list in case we execute detach
command. */
- tp_array = xmalloc (sizeof (struct thread_info *) * tc);
+ tp_array = XNEWVEC (struct thread_info *, tc);
make_cleanup (xfree, tp_array);
ALL_NON_EXITED_THREADS (tp)