]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Set inferior_ptid in ravenscar_thread_target::update_thread_list
authorTom Tromey <tromey@adacore.com>
Fri, 7 Aug 2020 16:26:45 +0000 (10:26 -0600)
committerTom Tromey <tromey@adacore.com>
Fri, 7 Aug 2020 16:26:47 +0000 (10:26 -0600)
Commit 2da4b788f ("Don't write to inferior_ptid in
ravenscar-thread.c") caused a Ravenscar regression (which, FWIW, is
understandable because Ravenscar is difficult to test).  Namely,
ravenscar_thread_target::update_thread_list calls
iterate_over_live_ada_tasks, which calls ada_build_task_list, which
uses target_has_stack -- which relies on inferior_ptid.

This patch changes update_thread_list to ensure that inferior_ptid is
set before making this call.  This avoids various failures on
Ravenscar targets.

gdb/ChangeLog
2020-08-07  Tom Tromey  <tromey@adacore.com>

* ravenscar-thread.c (update_thread_list): Set inferior_ptid.

gdb/ChangeLog
gdb/ravenscar-thread.c

index 640fb397a7d51ae1b3b290b35f147cb695b53963..6ae8d7bc1ad3b32490ac3c2f5e85fac619c3e98a 100644 (file)
@@ -1,3 +1,7 @@
+2020-08-07  Tom Tromey  <tromey@adacore.com>
+
+       * ravenscar-thread.c (update_thread_list): Set inferior_ptid.
+
 2020-08-07  Tom Tromey  <tromey@adacore.com>
 
        * ravenscar-thread.c (ravenscar_thread_target::wait): Call
index 459e5ea3ed3822342806a429fca9f4f41c90bca2..37df2188cf351ac4ce724da9540ccf6711b510ff 100644 (file)
@@ -419,6 +419,12 @@ ravenscar_thread_target::add_thread (struct ada_task_info *task)
 void
 ravenscar_thread_target::update_thread_list ()
 {
+  /* iterate_over_live_ada_tasks requires that inferior_ptid be set,
+     but this isn't always the case in target methods.  So, we ensure
+     it here.  */
+  scoped_restore save_ptid = make_scoped_restore (&inferior_ptid,
+                                                 m_base_ptid);
+
   /* Do not clear the thread list before adding the Ada task, to keep
      the thread that the process stratum has included into it
      (m_base_ptid) and the running thread, that may not have been included