aboutsummaryrefslogtreecommitdiff
path: root/gdb/ravenscar-thread.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2020-08-07 10:26:45 -0600
committerTom Tromey <tromey@adacore.com>2020-08-07 10:26:47 -0600
commita52b3ae2b101b0fefcfa8c4534472525bcbfdf3d (patch)
treef13defcaaee96ec566acc3721af5e9a266f091d4 /gdb/ravenscar-thread.c
parent0e29517d97e94bfceb3abce77aea3b249f6cdaf3 (diff)
downloadbinutils-a52b3ae2b101b0fefcfa8c4534472525bcbfdf3d.zip
binutils-a52b3ae2b101b0fefcfa8c4534472525bcbfdf3d.tar.gz
binutils-a52b3ae2b101b0fefcfa8c4534472525bcbfdf3d.tar.bz2
Fix remaining Ravenscar regressions
Testing showed a few more Ravenscar regressions arising from upstream. In particular, gdb now uses the current thread in some places where inferior_ptid was previously used. This patch fixes the problem by arranging to save and restore the thread now. gdb/ChangeLog 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.
Diffstat (limited to 'gdb/ravenscar-thread.c')
-rw-r--r--gdb/ravenscar-thread.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 37df218..387ebcb 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -151,6 +151,15 @@ private:
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
@@ -571,8 +580,8 @@ ravenscar_thread_target::prepare_to_store (struct regcache *regcache)
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 ();
}
@@ -581,8 +590,8 @@ ravenscar_thread_target::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 ();
}
@@ -591,8 +600,8 @@ ravenscar_thread_target::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 ();
}
@@ -601,8 +610,8 @@ ravenscar_thread_target::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);
}
@@ -620,8 +629,8 @@ ravenscar_thread_target::mourn_inferior ()
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);
}