Handle case where Ada task is current but not listed
Currently, the ravenscar runtime can mark an Ada task as the current
task, before adding it to the list of tasks that can be read by gdb.
In this scenario, gdb can sometimes crash in
ravenscar_get_thread_base_cpu with:
../../src/gdb/ravenscar-thread.c:167: internal-error: int ravenscar_get_thread_base_cpu(ptid_t): Assertion `task_info != NULL' failed.
However, as ravenscar_get_thread_base_cpu is only called to find the
base CPU, we can simply record this when registering the thread, and
look this up later.
gdb/ChangeLog
2020-08-07 Tom Tromey <tromey@adacore.com>
* ravenscar-thread.c (ravenscar_thread_target) <get_base_cpu,
get_base_thread_from_ravenscar_task>: Now methods.
<m_cpu_map>: New member.
(ravenscar_thread_target::get_thread_base_cpu): Rename from
ravenscar_get_thread_base_cpu. Check m_cpu_map.
(ravenscar_thread_target::task_is_currently_active): Update.
(ravenscar_thread_target::get_base_thread_from_ravenscar_task):
Now a method.
(ravenscar_thread_target::add_active_thread): Put initial thread
into the m_cpu_map.