Added a function to the Host that gets a dummy target
for it, so that people who want to use LLDB as a
calculator can run simple expressions without needing
a target or process.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@143147 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Host/common/Host.cpp b/source/Host/common/Host.cpp
index f88c76b..ebb15cc 100644
--- a/source/Host/common/Host.cpp
+++ b/source/Host/common/Host.cpp
@@ -10,6 +10,7 @@
#include "lldb/Host/Host.h"
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/ConstString.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/StreamString.h"
@@ -18,6 +19,7 @@
#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Target/Process.h"
+#include "lldb/Target/TargetList.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/MachO.h"
@@ -1165,6 +1167,24 @@
}
#endif
+lldb::TargetSP
+Host::GetDummyTarget (lldb_private::Debugger &debugger)
+{
+ static TargetSP dummy_target;
+
+ if (!dummy_target)
+ {
+ Error err = debugger.GetTargetList().CreateTarget(debugger,
+ FileSpec(),
+ Host::GetTargetTriple().AsCString(),
+ false,
+ NULL,
+ dummy_target);
+ }
+
+ return dummy_target;
+}
+
#if !defined (__APPLE__)
bool
Host::OpenFileInExternalEditor (const FileSpec &file_spec, uint32_t line_no)