teemperor created this revision.
teemperor added a reviewer: labath.
Herald added subscribers: lldb-commits, abidh.
Herald added a project: LLDB.
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).
Repository:
rLLDB LLDB
https://reviews.llvm.org/D66581
Files:
lldb/include/lldb/Core/Debugger.h
lldb/source/Core/Debugger.cpp
Index: lldb/source/Core/Debugger.cpp
===================================================================
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -721,6 +721,9 @@
assert(default_platform_sp);
m_platform_list.Append(default_platform_sp, true);
+ m_dummy_target = m_target_list.GetDummyTarget(*this);
+ assert(m_dummy_target.get() && "Couldn't construct dummy target?");
+
m_collection_sp->Initialize(g_debugger_properties);
m_collection_sp->AppendProperty(
ConstString("target"),
@@ -1603,9 +1606,7 @@
}
}
-Target *Debugger::GetDummyTarget() {
- return m_target_list.GetDummyTarget(*this).get();
-}
+Target *Debugger::GetDummyTarget() { return m_dummy_target.get(); }
Target *Debugger::GetSelectedOrDummyTarget(bool prefer_dummy) {
Target *target = nullptr;
Index: lldb/include/lldb/Core/Debugger.h
===================================================================
--- lldb/include/lldb/Core/Debugger.h
+++ lldb/include/lldb/Core/Debugger.h
@@ -400,6 +400,7 @@
Broadcaster m_sync_broadcaster;
lldb::ListenerSP m_forward_listener_sp;
llvm::once_flag m_clear_once;
+ lldb::TargetSP m_dummy_target;
// Events for m_sync_broadcaster
enum {
Index: lldb/source/Core/Debugger.cpp
===================================================================
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -721,6 +721,9 @@
assert(default_platform_sp);
m_platform_list.Append(default_platform_sp, true);
+ m_dummy_target = m_target_list.GetDummyTarget(*this);
+ assert(m_dummy_target.get() && "Couldn't construct dummy target?");
+
m_collection_sp->Initialize(g_debugger_properties);
m_collection_sp->AppendProperty(
ConstString("target"),
@@ -1603,9 +1606,7 @@
}
}
-Target *Debugger::GetDummyTarget() {
- return m_target_list.GetDummyTarget(*this).get();
-}
+Target *Debugger::GetDummyTarget() { return m_dummy_target.get(); }
Target *Debugger::GetSelectedOrDummyTarget(bool prefer_dummy) {
Target *target = nullptr;
Index: lldb/include/lldb/Core/Debugger.h
===================================================================
--- lldb/include/lldb/Core/Debugger.h
+++ lldb/include/lldb/Core/Debugger.h
@@ -400,6 +400,7 @@
Broadcaster m_sync_broadcaster;
lldb::ListenerSP m_forward_listener_sp;
llvm::once_flag m_clear_once;
+ lldb::TargetSP m_dummy_target;
// Events for m_sync_broadcaster
enum {
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits