+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 ()
+ : m_base_ptid (inferior_ptid)
+ {
+ thread_info *thr = add_active_thread ();
+ if (thr != nullptr)
+ switch_to_thread (thr);
+ }
+
+ const target_info &info () const override
+ { return ravenscar_target_info; }
+
+ strata stratum () const override { return thread_stratum; }
+
+ ptid_t wait (ptid_t, struct target_waitstatus *, int) override;
+ void resume (ptid_t, int, enum gdb_signal) override;
+
+ void fetch_registers (struct regcache *, int) override;
+ void store_registers (struct regcache *, int) override;
+
+ void prepare_to_store (struct regcache *) override;
+
+ bool stopped_by_sw_breakpoint () override;
+
+ bool stopped_by_hw_breakpoint () override;
+
+ bool stopped_by_watchpoint () override;
+
+ bool stopped_data_address (CORE_ADDR *) override;
+
+ bool thread_alive (ptid_t ptid) override;
+
+ int core_of_thread (ptid_t ptid) override;
+
+ void update_thread_list () override;
+
+ const char *extra_thread_info (struct thread_info *) override;
+
+ std::string pid_to_str (ptid_t) override;
+
+ ptid_t get_ada_task_ptid (long lwp, long thread) override;
+
+ void mourn_inferior () override;
+
+ void close () override
+ {
+ delete this;
+ }
+
+private:
+
+ /* PTID of the last thread that received an event.
+ This can be useful to determine the associated task that received
+ the event, to make it the current task. */
+ ptid_t m_base_ptid;
+
+ thread_info *add_active_thread ();
+ ptid_t active_task (int cpu);
+ bool task_is_currently_active (ptid_t ptid);
+ bool runtime_initialized ();
+};
+
+/* Return true iff PTID corresponds to a ravenscar task. */
+
+static bool