This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada 6/6] ravenscar: update inferior ptid with event ptid


From: Jerome Guitton <guitton@adacore.com>

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.
---
 gdb/ravenscar-thread.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 00593b84db..30745f7caa 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 ();
     }
-- 
2.11.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]