Fetch registers from correct thread in ravenscar-thread.c
Fabien also noticed that gdb would not report a stop correctly when
using Ravenscar. This patch fixes the bug by making a few changes:
* ravenscar_thread_target::wait now updates the inferior ptid before
updating the thread list. This ensures that a new thread is
correctly associated with the underlying CPU.
* The fetch_registers, store_registers, and prepare_to_store methods
now save and restore the regcache's ptid before doing the operation
on the underlying live thread. This ensures that gdb informs the
remote of a thread it knows about, as opposed to using a Ravenscar
thread, which probably will not be recognized.
gdb/ChangeLog
2020-08-07 Tom Tromey <tromey@adacore.com>
* ravenscar-thread.c (ravenscar_thread_target::wait): Call
update_inferior_ptid before update_thread_list.
(temporarily_change_regcache_ptid): New class.
(ravenscar_thread_target::fetch_registers)
(ravenscar_thread_target::store_registers)
(ravenscar_thread_target::prepare_to_store): Use base thread when
forwarding operation.