Avoid crash in ravenscar_thread_target::wait
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:45 +0000 (10:26 -0600)
An earlier patch caused a Ravenscar regression in
ravenscar_thread_target::wait.  In particular, add_active_thread can
return NULL when the runtime is not initialized.

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

* ravenscar-thread.c (ravenscar_thread_target::wait): Check
runtime_initialized.

gdb/ChangeLog
gdb/ravenscar-thread.c

index 81d0527c59c0ace30d148dd9126bdd7b8d1a1ae9..d1f705838849cc6e2b9a0f5babe916187b32f5a2 100644 (file)
@@ -1,3 +1,8 @@
+2020-08-07  Tom Tromey  <tromey@adacore.com>
+
+       * ravenscar-thread.c (ravenscar_thread_target::wait): Check
+       runtime_initialized.
+
 2020-08-07  Tom Tromey  <tromey@adacore.com>
 
        * ravenscar-thread.c (ravenscar_thread_target): Don't call
index 7fca51da2a79f9271449d5462af6279351871717..47001de42d39eab4566679fc8ec06dc5b47aacb8 100644 (file)
@@ -354,7 +354,8 @@ ravenscar_thread_target::wait (ptid_t ptid,
      because we might try switching threads (and thus sending packets)
      after the remote has disconnected.  */
   if (status->kind != TARGET_WAITKIND_EXITED
-      && status->kind != TARGET_WAITKIND_SIGNALLED)
+      && status->kind != TARGET_WAITKIND_SIGNALLED
+      && runtime_initialized ())
     {
       m_base_ptid = event_ptid;
       this->update_thread_list ();