PR gdb/9747:
[deliverable/binutils-gdb.git] / gdb / thread.c
index 44e4ba2dc496d09cc9cda9ca9c0b28bca8a93b07..8a98b8ec4b6af57b6f57cd55c4ba94ccf6a7babc 100644 (file)
@@ -632,6 +632,55 @@ set_stop_requested (ptid_t ptid, int stop)
     observer_notify_thread_stop_requested (ptid);
 }
 
+void
+finish_thread_state (ptid_t ptid)
+{
+  struct thread_info *tp;
+  int all;
+  int any_started = 0;
+
+  all = ptid_equal (ptid, minus_one_ptid);
+
+  if (all || ptid_is_pid (ptid))
+    {
+      for (tp = thread_list; tp; tp = tp->next)
+       {
+         if (tp->state_ == THREAD_EXITED)
+           continue;
+         if (all || ptid_get_pid (ptid) == ptid_get_pid (tp->ptid))
+           {
+             if (tp->executing_ && tp->state_ == THREAD_STOPPED)
+               any_started = 1;
+             tp->state_ = tp->executing_ ? THREAD_RUNNING : THREAD_STOPPED;
+           }
+       }
+    }
+  else
+    {
+      tp = find_thread_pid (ptid);
+      gdb_assert (tp);
+      if (tp->state_ != THREAD_EXITED)
+       {
+         if (tp->executing_ && tp->state_ == THREAD_STOPPED)
+           any_started = 1;
+         tp->state_ = tp->executing_ ? THREAD_RUNNING : THREAD_STOPPED;
+       }
+    }
+
+  if (any_started)
+    observer_notify_target_resumed (ptid);
+}
+
+void
+finish_thread_state_cleanup (void *arg)
+{
+  ptid_t *ptid_p = arg;
+
+  gdb_assert (arg);
+
+  finish_thread_state (*ptid_p);
+}
+
 /* Prints the list of threads and their details on UIOUT.
    This is a version of 'info_thread_command' suitable for
    use from MI.  
This page took 0.028505 seconds and 4 git commands to generate.