diff options
author | Raphael Isemann <teemperor@gmail.com> | 2019-08-26 09:20:59 +0000 |
---|---|---|
committer | Raphael Isemann <teemperor@gmail.com> | 2019-08-26 09:20:59 +0000 |
commit | d43d912b4bf8f4886ca375225d4ebd7d512ea7cf (patch) | |
tree | 279d0884ae86374b41a10424c99eee7dfe5bd049 | |
parent | 0a6000f2cbb40abd008338895a471f474347b80d (diff) | |
download | bcm5719-llvm-d43d912b4bf8f4886ca375225d4ebd7d512ea7cf.tar.gz bcm5719-llvm-d43d912b4bf8f4886ca375225d4ebd7d512ea7cf.zip |
[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
-rw-r--r-- | lldb/include/lldb/Core/Debugger.h | 3 | ||||
-rw-r--r-- | lldb/source/Core/Debugger.cpp | 7 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h index 8e857e009a1..2b5bf513651 100644 --- a/lldb/include/lldb/Core/Debugger.h +++ b/lldb/include/lldb/Core/Debugger.h @@ -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 { diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 513ea7a0d04..683ecefe097 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -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) { |