Replace "struct continuation" mechanism by something more extensible
[external/binutils.git] / gdb / thread.c
index 29c4790..5498fc1 100644 (file)
@@ -43,6 +43,7 @@
 #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.  */
 
@@ -158,6 +159,19 @@ thread_has_single_step_breakpoint_here (struct thread_info *tp,
          && 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)
 {
@@ -175,6 +189,8 @@ clear_thread_inferior_resources (struct thread_info *tp)
 
   btrace_teardown (tp);
 
+  thread_cancel_execution_command (tp);
+
   do_all_intermediate_continuations_thread (tp, 1);
   do_all_continuations_thread (tp, 1);
 }