ravenscar: update inferior ptid with event ptid

When debugging a program using a ravenscar runtime, the thread
layer sometimes gets confused, and even missing some threads.
This was traced to an assumption that ravenscar_wait was making,
which is that calling the "to_wait" target_ops method would
set the inferior_ptid, so that we could then use that assumption
to update our thread_list and current ptid. However, this has not
been the case for quite a while now. This patch fixes the problem
by assigning inferior_ptid the ptid returned by "to_wait".

gdb/ChangeLog:

	* ravenscar-thread.c (ravenscar_wait): Update inferior ptid
	with event ptid from the lower layer before doing the
	ravenscar-specific update.
This commit is contained in:
Jerome Guitton 2017-11-21 14:10:01 -08:00 committed by Joel Brobecker
parent 54aa6c67f5
commit 3b1b69bffe
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2017-11-21 Jerome Guitton <guitton@adacore.com>
* ravenscar-thread.c (ravenscar_wait): Update inferior ptid
with event ptid from the lower layer before doing the
ravenscar-specific update.
2017-11-21 Joel Brobecker <brobecker@adacore.com>
* ravenscar-thread.c (is_ravenscar_task): Also verify that

View File

@ -297,9 +297,10 @@ ravenscar_wait (struct target_ops *ops, ptid_t ptid,
int options)
{
struct target_ops *beneath = find_target_beneath (ops);
ptid_t event_ptid;
inferior_ptid = base_ptid;
beneath->to_wait (beneath, base_ptid, status, 0);
event_ptid = beneath->to_wait (beneath, base_ptid, status, 0);
/* Find any new threads that might have been created, and update
inferior_ptid to the active thread.
@ -310,6 +311,7 @@ ravenscar_wait (struct target_ops *ops, ptid_t ptid,
if (status->kind != TARGET_WAITKIND_EXITED
&& status->kind != TARGET_WAITKIND_SIGNALLED)
{
inferior_ptid = event_ptid;
ravenscar_update_thread_list (ops);
ravenscar_update_inferior_ptid ();
}