From: Tom Tromey Date: Fri, 7 Aug 2020 16:26:45 +0000 (-0600) Subject: Call add_active_thread after pushing the ravenscar target X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3d4470e5d482ba5908651feb246d110453c8f31b;p=binutils-gdb.git Call add_active_thread after pushing the ravenscar target Currently ravenscar-thread.c calls add_active_thread before pushing the ravenscar target. This yields an initial thread announcement of "[Thread 0]". Calling add_active_thread after pushing the target fixes this. gdb/ChangeLog 2020-08-07 Tom Tromey * ravenscar-thread.c (ravenscar_thread_target): Don't call add_active_thread. (ravenscar_thread_target::add_active_thread): Now public. (ravenscar_inferior_created): Call add_active_thread after pushing the target. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 88583bd73d5..81d0527c59c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2020-08-07 Tom Tromey + + * ravenscar-thread.c (ravenscar_thread_target): Don't call + add_active_thread. + (ravenscar_thread_target::add_active_thread): Now public. + (ravenscar_inferior_created): Call add_active_thread after pushing + the target. + 2020-08-07 Simon Marchi * regcache.c (ptid_regcache_map): New type. diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index 72253188c71..7fca51da2a7 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -79,9 +79,6 @@ struct ravenscar_thread_target final : public target_ops ravenscar_thread_target () : m_base_ptid (inferior_ptid) { - thread_info *thr = add_active_thread (); - if (thr != nullptr) - switch_to_thread (thr); } const target_info &info () const override @@ -124,6 +121,8 @@ struct ravenscar_thread_target final : public target_ops delete this; } + thread_info *add_active_thread (); + private: /* PTID of the last thread that received an event. @@ -131,7 +130,6 @@ private: the event, to make it the current task. */ ptid_t m_base_ptid; - thread_info *add_active_thread (); ptid_t active_task (int cpu); bool task_is_currently_active (ptid_t ptid); bool runtime_initialized (); @@ -548,8 +546,11 @@ ravenscar_inferior_created (struct target_ops *target, int from_tty) return; } - target_ops_up target_holder (new ravenscar_thread_target ()); - push_target (std::move (target_holder)); + ravenscar_thread_target *rtarget = new ravenscar_thread_target (); + push_target (target_ops_up (rtarget)); + thread_info *thr = rtarget->add_active_thread (); + if (thr != nullptr) + switch_to_thread (thr); } ptid_t