From e95465793dedc0a75406c159ad3180d55cd4a94d Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 7 Aug 2020 10:26:45 -0600 Subject: [PATCH] Avoid crash in ravenscar_thread_target::wait 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 * ravenscar-thread.c (ravenscar_thread_target::wait): Check runtime_initialized. --- gdb/ChangeLog | 5 +++++ gdb/ravenscar-thread.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 81d0527c59c..d1f70583884 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-08-07 Tom Tromey + + * ravenscar-thread.c (ravenscar_thread_target::wait): Check + runtime_initialized. + 2020-08-07 Tom Tromey * ravenscar-thread.c (ravenscar_thread_target): Don't call diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index 7fca51da2a7..47001de42d3 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -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 (); -- 2.30.2