Fix SBO bit in disassembly mask for ldrah on AArch64.
[deliverable/binutils-gdb.git] / gdb / ravenscar-thread.c
index 03cbe3d9e7abe945d80b9e61656a0ca0bb11d892..8bd31a5a725a2cf9b6a2b0306886cea6e233bc9c 100644 (file)
@@ -73,19 +73,19 @@ static const char first_task_name[] = "system__tasking__debug__first_task";
 static const char ravenscar_runtime_initializer[] =
   "system__bb__threads__initialize";
 
+static const target_info ravenscar_target_info = {
+  "ravenscar",
+  N_("Ravenscar tasks."),
+  N_("Ravenscar tasks support.")
+};
+
 struct ravenscar_thread_target final : public target_ops
 {
   ravenscar_thread_target ()
   { to_stratum = thread_stratum; }
 
-  const char *shortname () override
-  { return "ravenscar"; }
-
-  const char *longname () override
-  { return _("Ravenscar tasks."); }
-
-  const char *doc () override
-  { return _("Ravenscar tasks support."); }
+  const target_info &info () const override
+  { return ravenscar_target_info; }
 
   ptid_t wait (ptid_t, struct target_waitstatus *, int) override;
   void resume (ptid_t, int, enum gdb_signal) override;
@@ -147,7 +147,7 @@ is_ravenscar_task (ptid_t ptid)
      2.0.48 for LEON3 sends 'm0' as a reply to the 'qfThreadInfo'
      query, which the remote protocol layer then treats as a thread
      whose TID is 0.  This is obviously not a ravenscar task.  */
-  return ptid_get_lwp (ptid) == 0 && ptid_get_tid (ptid) != 0;
+  return ptid.lwp () == 0 && ptid.tid () != 0;
 }
 
 /* Given PTID, which can be either a ravenscar task or a CPU thread,
@@ -171,7 +171,7 @@ ravenscar_get_thread_base_cpu (ptid_t ptid)
   else
     {
       /* We assume that the LWP of the PTID is equal to the CPU number.  */
-      base_cpu = ptid_get_lwp (ptid);
+      base_cpu = ptid.lwp ();
     }
 
   return base_cpu;
@@ -193,7 +193,7 @@ ravenscar_task_is_currently_active (ptid_t ptid)
   ptid_t active_task_ptid
     = ravenscar_active_task (ravenscar_get_thread_base_cpu (ptid));
 
-  return ptid_equal (ptid, active_task_ptid);
+  return ptid == active_task_ptid;
 }
 
 /* Return the CPU thread (as a ptid_t) on which the given ravenscar
@@ -211,7 +211,7 @@ get_base_thread_from_ravenscar_task (ptid_t ptid)
     return ptid;
 
   base_cpu = ravenscar_get_thread_base_cpu (ptid);
-  return ptid_build (ptid_get_pid (ptid), base_cpu, 0);
+  return ptid_t (ptid.pid (), base_cpu, 0);
 }
 
 /* Fetch the ravenscar running thread from target memory and
@@ -235,7 +235,7 @@ ravenscar_update_inferior_ptid (void)
   /* Make sure we set base_ptid before calling ravenscar_active_task
      as the latter relies on it.  */
   inferior_ptid = ravenscar_active_task (base_cpu);
-  gdb_assert (!ptid_equal (inferior_ptid, null_ptid));
+  gdb_assert (inferior_ptid != null_ptid);
 
   /* The running thread may not have been added to
      system.tasking.debug's list yet; so ravenscar_update_thread_list
@@ -291,7 +291,7 @@ has_ravenscar_runtime (void)
 static int
 ravenscar_runtime_initialized (void)
 {
-  return (!(ptid_equal (ravenscar_active_task (1), null_ptid)));
+  return (!(ravenscar_active_task (1) == null_ptid));
 }
 
 /* Return the ID of the thread that is currently running.
@@ -323,10 +323,8 @@ get_running_thread_id (int cpu)
 void
 ravenscar_thread_target::resume (ptid_t ptid, int step, enum gdb_signal siggnal)
 {
-  struct target_ops *beneath = find_target_beneath (this);
-
   inferior_ptid = base_ptid;
-  beneath->resume (base_ptid, step, siggnal);
+  beneath ()->resume (base_ptid, step, siggnal);
 }
 
 ptid_t
@@ -334,11 +332,10 @@ ravenscar_thread_target::wait (ptid_t ptid,
                               struct target_waitstatus *status,
                               int options)
 {
-  struct target_ops *beneath = find_target_beneath (this);
   ptid_t event_ptid;
 
   inferior_ptid = base_ptid;
-  event_ptid = beneath->wait (base_ptid, status, 0);
+  event_ptid = beneath ()->wait (base_ptid, status, 0);
   /* Find any new threads that might have been created, and update
      inferior_ptid to the active thread.
 
@@ -387,7 +384,7 @@ ravenscar_active_task (int cpu)
   if (tid == 0)
     return null_ptid;
   else
-    return ptid_build (ptid_get_pid (base_ptid), 0, tid);
+    return ptid_t (base_ptid.pid (), 0, tid);
 }
 
 const char *
@@ -408,15 +405,14 @@ ravenscar_thread_target::pid_to_str (ptid_t ptid)
 {
   static char buf[30];
 
-  snprintf (buf, sizeof (buf), "Thread %#x", (int) ptid_get_tid (ptid));
+  snprintf (buf, sizeof (buf), "Thread %#x", (int) ptid.tid ());
   return buf;
 }
 
 void
 ravenscar_thread_target::fetch_registers (struct regcache *regcache, int regnum)
 {
-  struct target_ops *beneath = find_target_beneath (this);
-  ptid_t ptid = regcache_get_ptid (regcache);
+  ptid_t ptid = regcache->ptid ();
 
   if (ravenscar_runtime_initialized ()
       && is_ravenscar_task (ptid)
@@ -429,15 +425,14 @@ ravenscar_thread_target::fetch_registers (struct regcache *regcache, int regnum)
       arch_ops->to_fetch_registers (regcache, regnum);
     }
   else
-    beneath->fetch_registers (regcache, regnum);
+    beneath ()->fetch_registers (regcache, regnum);
 }
 
 void
 ravenscar_thread_target::store_registers (struct regcache *regcache,
                                          int regnum)
 {
-  target_ops *beneath = find_target_beneath (this);
-  ptid_t ptid = regcache_get_ptid (regcache);
+  ptid_t ptid = regcache->ptid ();
 
   if (ravenscar_runtime_initialized ()
       && is_ravenscar_task (ptid)
@@ -447,17 +442,16 @@ ravenscar_thread_target::store_registers (struct regcache *regcache,
       struct ravenscar_arch_ops *arch_ops
        = gdbarch_ravenscar_ops (gdbarch);
 
-      beneath->store_registers (regcache, regnum);
+      beneath ()->store_registers (regcache, regnum);
     }
   else
-    beneath->store_registers (regcache, regnum);
+    beneath ()->store_registers (regcache, regnum);
 }
 
 void
 ravenscar_thread_target::prepare_to_store (struct regcache *regcache)
 {
-  target_ops *beneath = find_target_beneath (this);
-  ptid_t ptid = regcache_get_ptid (regcache);
+  ptid_t ptid = regcache->ptid ();
 
   if (ravenscar_runtime_initialized ()
       && is_ravenscar_task (ptid)
@@ -467,10 +461,10 @@ ravenscar_thread_target::prepare_to_store (struct regcache *regcache)
       struct ravenscar_arch_ops *arch_ops
        = gdbarch_ravenscar_ops (gdbarch);
 
-      beneath->prepare_to_store (regcache);
+      beneath ()->prepare_to_store (regcache);
     }
   else
-    beneath->prepare_to_store (regcache);
+    beneath ()->prepare_to_store (regcache);
 }
 
 /* Implement the to_stopped_by_sw_breakpoint target_ops "method".  */
@@ -479,11 +473,10 @@ bool
 ravenscar_thread_target::stopped_by_sw_breakpoint ()
 {
   ptid_t saved_ptid = inferior_ptid;
-  struct target_ops *beneath = find_target_beneath (this);
   bool result;
 
   inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid);
-  result = beneath->stopped_by_sw_breakpoint ();
+  result = beneath ()->stopped_by_sw_breakpoint ();
   inferior_ptid = saved_ptid;
   return result;
 }
@@ -494,11 +487,10 @@ bool
 ravenscar_thread_target::stopped_by_hw_breakpoint ()
 {
   ptid_t saved_ptid = inferior_ptid;
-  struct target_ops *beneath = find_target_beneath (this);
   bool result;
 
   inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid);
-  result = beneath->stopped_by_hw_breakpoint ();
+  result = beneath ()->stopped_by_hw_breakpoint ();
   inferior_ptid = saved_ptid;
   return result;
 }
@@ -509,11 +501,10 @@ bool
 ravenscar_thread_target::stopped_by_watchpoint ()
 {
   ptid_t saved_ptid = inferior_ptid;
-  struct target_ops *beneath = find_target_beneath (this);
   bool result;
 
   inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid);
-  result = beneath->stopped_by_watchpoint ();
+  result = beneath ()->stopped_by_watchpoint ();
   inferior_ptid = saved_ptid;
   return result;
 }
@@ -524,11 +515,10 @@ bool
 ravenscar_thread_target::stopped_data_address (CORE_ADDR *addr_p)
 {
   ptid_t saved_ptid = inferior_ptid;
-  struct target_ops *beneath = find_target_beneath (this);
   bool result;
 
   inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid);
-  result = beneath->stopped_data_address (addr_p);
+  result = beneath ()->stopped_data_address (addr_p);
   inferior_ptid = saved_ptid;
   return result;
 }
@@ -536,10 +526,8 @@ ravenscar_thread_target::stopped_data_address (CORE_ADDR *addr_p)
 void
 ravenscar_thread_target::mourn_inferior ()
 {
-  struct target_ops *beneath = find_target_beneath (this);
-
   base_ptid = null_ptid;
-  beneath->mourn_inferior ();
+  beneath ()->mourn_inferior ();
   unpush_target (&ravenscar_ops);
 }
 
@@ -549,11 +537,10 @@ int
 ravenscar_thread_target::core_of_thread (ptid_t ptid)
 {
   ptid_t saved_ptid = inferior_ptid;
-  struct target_ops *beneath = find_target_beneath (this);
   int result;
 
   inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid);
-  result = beneath->core_of_thread (inferior_ptid);
+  result = beneath ()->core_of_thread (inferior_ptid);
   inferior_ptid = saved_ptid;
   return result;
 }
@@ -584,7 +571,7 @@ ravenscar_inferior_created (struct target_ops *target, int from_tty)
 ptid_t
 ravenscar_thread_target::get_ada_task_ptid (long lwp, long thread)
 {
-  return ptid_build (ptid_get_pid (base_ptid), 0, thread);
+  return ptid_t (base_ptid.pid (), 0, thread);
 }
 
 /* Command-list for the "set/show ravenscar" prefix command.  */
This page took 0.033062 seconds and 4 git commands to generate.