forked from OSchip/llvm-project
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. llvm-svn: 143147
This commit is contained in:
parent
f4807a19e8
commit
c0a6e0619d
|
@ -355,6 +355,9 @@ public:
|
|||
static Error
|
||||
LaunchProcess (ProcessLaunchInfo &launch_info);
|
||||
|
||||
static lldb::TargetSP
|
||||
GetDummyTarget (Debugger &debugger);
|
||||
|
||||
static bool
|
||||
OpenFileInExternalEditor (const FileSpec &file_spec,
|
||||
uint32_t line_no);
|
||||
|
|
|
@ -283,6 +283,10 @@ CommandObjectExpression::EvaluateExpression
|
|||
)
|
||||
{
|
||||
Target *target = m_exe_ctx.GetTargetPtr();
|
||||
|
||||
if (!target)
|
||||
target = Host::GetDummyTarget(m_interpreter.GetDebugger()).get();
|
||||
|
||||
if (target)
|
||||
{
|
||||
lldb::ValueObjectSP result_valobj_sp;
|
||||
|
|
|
@ -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 @@ Host::GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &process_info)
|
|||
}
|
||||
#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)
|
||||
|
|
Loading…
Reference in New Issue