+2020-08-07 Tom Tromey <tromey@adacore.com>
+
+ * ravenscar-thread.c
+ (ravenscar_thread_target::set_base_thread_from_ravenscar_task):
+ New method.
+ (ravenscar_thread_target::wait): Check
+ runtime_initialized.
+ (ravenscar_thread_target::prepare_to_store)
+ (ravenscar_thread_target::stopped_by_sw_breakpoint)
+ (ravenscar_thread_target::stopped_by_hw_breakpoint)
+ (ravenscar_thread_target::stopped_by_watchpoint)
+ (ravenscar_thread_target::stopped_data_address)
+ (ravenscar_thread_target::core_of_thread): Use
+ scoped_restore_current_thread and
+ set_base_thread_from_ravenscar_task.
+
2020-08-07 Tom Tromey <tromey@adacore.com>
* ravenscar-thread.c (update_thread_list): Set inferior_ptid.
ptid_t get_base_thread_from_ravenscar_task (ptid_t ptid);
void add_thread (struct ada_task_info *task);
+ /* Like switch_to_thread, but uses the base ptid for the thread. */
+ void set_base_thread_from_ravenscar_task (ptid_t ptid)
+ {
+ process_stratum_target *proc_target
+ = as_process_stratum_target (this->beneath ());
+ ptid_t underlying = get_base_thread_from_ravenscar_task (ptid);
+ switch_to_thread (find_thread_ptid (proc_target, underlying));
+ }
+
/* This maps a TID to the CPU on which it was running. This is
needed because sometimes the runtime will report an active task
that hasn't yet been put on the list of tasks that is read by
bool
ravenscar_thread_target::stopped_by_sw_breakpoint ()
{
- scoped_restore save_ptid = make_scoped_restore (&inferior_ptid);
- inferior_ptid = get_base_thread_from_ravenscar_task (inferior_ptid);
+ scoped_restore_current_thread saver;
+ set_base_thread_from_ravenscar_task (inferior_ptid);
return beneath ()->stopped_by_sw_breakpoint ();
}
bool
ravenscar_thread_target::stopped_by_hw_breakpoint ()
{
- scoped_restore save_ptid = make_scoped_restore (&inferior_ptid);
- inferior_ptid = get_base_thread_from_ravenscar_task (inferior_ptid);
+ scoped_restore_current_thread saver;
+ set_base_thread_from_ravenscar_task (inferior_ptid);
return beneath ()->stopped_by_hw_breakpoint ();
}
bool
ravenscar_thread_target::stopped_by_watchpoint ()
{
- scoped_restore save_ptid = make_scoped_restore (&inferior_ptid);
- inferior_ptid = get_base_thread_from_ravenscar_task (inferior_ptid);
+ scoped_restore_current_thread saver;
+ set_base_thread_from_ravenscar_task (inferior_ptid);
return beneath ()->stopped_by_watchpoint ();
}
bool
ravenscar_thread_target::stopped_data_address (CORE_ADDR *addr_p)
{
- scoped_restore save_ptid = make_scoped_restore (&inferior_ptid);
- inferior_ptid = get_base_thread_from_ravenscar_task (inferior_ptid);
+ scoped_restore_current_thread saver;
+ set_base_thread_from_ravenscar_task (inferior_ptid);
return beneath ()->stopped_data_address (addr_p);
}
int
ravenscar_thread_target::core_of_thread (ptid_t ptid)
{
- scoped_restore save_ptid = make_scoped_restore (&inferior_ptid);
- inferior_ptid = get_base_thread_from_ravenscar_task (inferior_ptid);
+ scoped_restore_current_thread saver;
+ set_base_thread_from_ravenscar_task (inferior_ptid);
return beneath ()->core_of_thread (inferior_ptid);
}