[lldb] Construct the dummy target when the first Debugger object is constructed

Summary:
We should always have a dummy target, so we might as well construct it directly when we create a Debugger object.

The idea is that if this patch doesn't cause any problems that we can get rid of all the logic
that handles situations where we don't have a dummy target (as all that code is currently
untested as there seems to be no way to have no dummy target in LLDB).

Reviewers: labath, jingham

Reviewed By: labath, jingham

Subscribers: jingham, abidh, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D66581

llvm-svn: 369885
This commit is contained in:
Raphael Isemann 2019-08-26 09:20:59 +00:00
parent 0a6000f2cb
commit d43d912b4b
2 changed files with 5 additions and 5 deletions

View File

@ -311,7 +311,7 @@ public:
// selected target, or if no target is present you want to prime the dummy
// target with entities that will be copied over to new targets.
Target *GetSelectedOrDummyTarget(bool prefer_dummy = false);
Target *GetDummyTarget();
Target *GetDummyTarget() { return m_dummy_target_sp.get(); }
lldb::BroadcasterManagerSP GetBroadcasterManager() {
return m_broadcaster_manager_sp;
@ -400,6 +400,7 @@ protected:
Broadcaster m_sync_broadcaster;
lldb::ListenerSP m_forward_listener_sp;
llvm::once_flag m_clear_once;
lldb::TargetSP m_dummy_target_sp;
// Events for m_sync_broadcaster
enum {

View File

@ -721,6 +721,9 @@ Debugger::Debugger(lldb::LogOutputCallback log_callback, void *baton)
assert(default_platform_sp);
m_platform_list.Append(default_platform_sp, true);
m_dummy_target_sp = m_target_list.GetDummyTarget(*this);
assert(m_dummy_target_sp.get() && "Couldn't construct dummy target?");
m_collection_sp->Initialize(g_debugger_properties);
m_collection_sp->AppendProperty(
ConstString("target"),
@ -1603,10 +1606,6 @@ void Debugger::JoinIOHandlerThread() {
}
}
Target *Debugger::GetDummyTarget() {
return m_target_list.GetDummyTarget(*this).get();
}
Target *Debugger::GetSelectedOrDummyTarget(bool prefer_dummy) {
Target *target = nullptr;
if (!prefer_dummy) {