Rename pid -> tid in windows-nat.c
[deliverable/binutils-gdb.git] / gdb / ravenscar-thread.c
index 186345d0fba10cea5391a2d6ba8ba608dd2189a3..0cc7e1dc75a7ba4571db30f7eb5e05615caa52d1 100644 (file)
@@ -57,8 +57,8 @@
    is running, switching to its corresponding ptid, and then performing
    the operation on that ptid using the target beneath us.  */
 
-/* If non-null, ravenscar task support is enabled.  */
-static int ravenscar_task_support = 1;
+/* If true, ravenscar task support is enabled.  */
+static bool ravenscar_task_support = true;
 
 static const char running_thread_name[] = "__gnat_running_thread_table";
 
@@ -110,7 +110,7 @@ struct ravenscar_thread_target final : public target_ops
 
   const char *extra_thread_info (struct thread_info *) override;
 
-  const char *pid_to_str (ptid_t) override;
+  std::string pid_to_str (ptid_t) override;
 
   ptid_t get_ada_task_ptid (long lwp, long thread) override;
 
@@ -323,8 +323,12 @@ void
 ravenscar_thread_target::resume (ptid_t ptid, int step,
                                 enum gdb_signal siggnal)
 {
+  /* If we see a wildcard resume, we simply pass that on.  Otherwise,
+     arrange to resume the base ptid.  */
   inferior_ptid = m_base_ptid;
-  beneath ()->resume (m_base_ptid, step, siggnal);
+  if (ptid != minus_one_ptid)
+    ptid = m_base_ptid;
+  beneath ()->resume (ptid, step, siggnal);
 }
 
 ptid_t
@@ -335,7 +339,9 @@ ravenscar_thread_target::wait (ptid_t ptid,
   ptid_t event_ptid;
 
   inferior_ptid = m_base_ptid;
-  event_ptid = beneath ()->wait (m_base_ptid, status, 0);
+  if (ptid != minus_one_ptid)
+    ptid = m_base_ptid;
+  event_ptid = beneath ()->wait (ptid, status, 0);
   /* Find any new threads that might have been created, and update
      inferior_ptid to the active thread.
 
@@ -350,6 +356,8 @@ ravenscar_thread_target::wait (ptid_t ptid,
       this->update_thread_list ();
       this->update_inferior_ptid ();
     }
+  else
+    inferior_ptid = m_base_ptid;
   return inferior_ptid;
 }
 
@@ -366,8 +374,6 @@ ravenscar_add_thread (struct ada_task_info *task)
 void
 ravenscar_thread_target::update_thread_list ()
 {
-  ada_build_task_list ();
-
   /* Do not clear the thread list before adding the Ada task, to keep
      the thread that the process stratum has included into it
      (m_base_ptid) and the running thread, that may not have been included
@@ -400,13 +406,10 @@ ravenscar_thread_target::thread_alive (ptid_t ptid)
   return true;
 }
 
-const char *
+std::string
 ravenscar_thread_target::pid_to_str (ptid_t ptid)
 {
-  static char buf[30];
-
-  snprintf (buf, sizeof (buf), "Thread %#x", (int) ptid.tid ());
-  return buf;
+  return string_printf ("Thread %#x", (int) ptid.tid ());
 }
 
 void
@@ -598,17 +601,17 @@ _initialize_ravenscar ()
   gdb::observers::inferior_created.attach (ravenscar_inferior_created);
 
   add_prefix_cmd ("ravenscar", no_class, set_ravenscar_command,
-                  _("Prefix command for changing Ravenscar-specific settings"),
+                  _("Prefix command for changing Ravenscar-specific settings."),
                   &set_ravenscar_list, "set ravenscar ", 0, &setlist);
 
   add_prefix_cmd ("ravenscar", no_class, show_ravenscar_command,
-                  _("Prefix command for showing Ravenscar-specific settings"),
+                  _("Prefix command for showing Ravenscar-specific settings."),
                   &show_ravenscar_list, "show ravenscar ", 0, &showlist);
 
   add_setshow_boolean_cmd ("task-switching", class_obscure,
                            &ravenscar_task_support, _("\
-Enable or disable support for GNAT Ravenscar tasks"), _("\
-Show whether support for GNAT Ravenscar tasks is enabled"),
+Enable or disable support for GNAT Ravenscar tasks."), _("\
+Show whether support for GNAT Ravenscar tasks is enabled."),
                            _("\
 Enable or disable support for task/thread switching with the GNAT\n\
 Ravenscar run-time library for bareboard configuration."),
This page took 0.024919 seconds and 4 git commands to generate.