[Lldb-commits] [PATCH] D66581: [lldb] Construct the dummy target when the first Dummy object is constructed

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 22 03:41:24 PDT 2019


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 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66581.216578.patch
Type: text/x-patch
Size: 1221 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190822/eab3eed5/attachment-0001.bin>


More information about the lldb-commits mailing list