From: Jerome Guitton Date: Tue, 21 Nov 2017 22:10:01 +0000 (-0800) Subject: ravenscar: update inferior ptid with event ptid X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3b1b69bffe522f22d269723856d2caa901041819;p=binutils-gdb.git 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index eb4b03ea4bc..1c77dea873e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2017-11-21 Jerome Guitton + + * 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 * ravenscar-thread.c (is_ravenscar_task): Also verify that diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index 00593b84db6..30745f7caac 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -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 (); }