aboutsummaryrefslogtreecommitdiff
path: root/gdb/ravenscar-thread.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2020-08-07 10:26:45 -0600
committerTom Tromey <tromey@adacore.com>2020-08-07 10:26:45 -0600
commit3d4470e5d482ba5908651feb246d110453c8f31b (patch)
tree029fe0b23f107d72a819c4c6d91f92191b3eae7a /gdb/ravenscar-thread.c
parent888bdb2b744515d111953a0a3aa674ea822416f9 (diff)
downloadgdb-3d4470e5d482ba5908651feb246d110453c8f31b.zip
gdb-3d4470e5d482ba5908651feb246d110453c8f31b.tar.gz
gdb-3d4470e5d482ba5908651feb246d110453c8f31b.tar.bz2
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 <tromey@adacore.com> * 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.
Diffstat (limited to 'gdb/ravenscar-thread.c')
-rw-r--r--gdb/ravenscar-thread.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 7225318..7fca51d 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