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;
void prepare_to_store (struct regcache *) override;
- int stopped_by_sw_breakpoint () override;
+ bool stopped_by_sw_breakpoint () override;
- int stopped_by_hw_breakpoint () override;
+ bool stopped_by_hw_breakpoint () override;
- int stopped_by_watchpoint () override;
+ bool stopped_by_watchpoint () override;
- int stopped_data_address (CORE_ADDR *) override;
+ bool stopped_data_address (CORE_ADDR *) override;
- int thread_alive (ptid_t ptid) override;
+ bool thread_alive (ptid_t ptid) override;
int core_of_thread (ptid_t ptid) override;
void mourn_inferior () override;
- int has_all_memory () override { return default_child_has_all_memory (); }
- int has_memory () override { return default_child_has_memory (); }
- int has_stack () override { return default_child_has_stack (); }
- int has_registers () override { return default_child_has_registers (); }
- int has_execution (ptid_t ptid) override
+ bool has_all_memory () override { return default_child_has_all_memory (); }
+ bool has_memory () override { return default_child_has_memory (); }
+ bool has_stack () override { return default_child_has_stack (); }
+ bool has_registers () override { return default_child_has_registers (); }
+ bool has_execution (ptid_t ptid) override
{ return default_child_has_execution (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,
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;
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
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
/* 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
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.
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
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.
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 *
return "Ravenscar task";
}
-int
+bool
ravenscar_thread_target::thread_alive (ptid_t ptid)
{
/* Ravenscar tasks are non-terminating. */
- return 1;
+ return true;
}
const char *
{
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)
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)
struct ravenscar_arch_ops *arch_ops
= gdbarch_ravenscar_ops (gdbarch);
- beneath->store_registers (regcache, regnum);
+ arch_ops->to_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)
struct ravenscar_arch_ops *arch_ops
= gdbarch_ravenscar_ops (gdbarch);
- beneath->prepare_to_store (regcache);
+ arch_ops->to_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". */
-int
+bool
ravenscar_thread_target::stopped_by_sw_breakpoint ()
{
ptid_t saved_ptid = inferior_ptid;
- struct target_ops *beneath = find_target_beneath (this);
- int result;
+ 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;
}
/* Implement the to_stopped_by_hw_breakpoint target_ops "method". */
-int
+bool
ravenscar_thread_target::stopped_by_hw_breakpoint ()
{
ptid_t saved_ptid = inferior_ptid;
- struct target_ops *beneath = find_target_beneath (this);
- int result;
+ 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;
}
/* Implement the to_stopped_by_watchpoint target_ops "method". */
-int
+bool
ravenscar_thread_target::stopped_by_watchpoint ()
{
ptid_t saved_ptid = inferior_ptid;
- struct target_ops *beneath = find_target_beneath (this);
- int result;
+ 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;
}
/* Implement the to_stopped_data_address target_ops "method". */
-int
+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);
- int result;
+ 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;
}
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);
}
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;
}
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. */