summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Debugger.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2015-10-20 00:23:46 +0000
committerSean Callanan <scallanan@apple.com>2015-10-20 00:23:46 +0000
commit3e7e915dca7dd543f11bdb6312e95a857df22618 (patch)
tree3641b5e85d967bd28f923e234999388a24fbdfd9 /lldb/source/Core/Debugger.cpp
parent7449ab983473b57a5b0980fb1cdbae8f67f43e60 (diff)
downloadbcm5719-llvm-3e7e915dca7dd543f11bdb6312e95a857df22618.tar.gz
bcm5719-llvm-3e7e915dca7dd543f11bdb6312e95a857df22618.zip
Added support for the "--repl" argument to LLDB.
This makes LLDB launch and create a REPL, specifying no target so that the REPL can create one for itself. Also added the "--repl-language" option, which specifies the language to use. Plumbed the relevant arguments and errors through the REPL creation mechanism. llvm-svn: 250773
Diffstat (limited to 'lldb/source/Core/Debugger.cpp')
-rw-r--r--lldb/source/Core/Debugger.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index e1779abb961..c5f46779fa5 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -31,6 +31,7 @@
#include "lldb/DataFormatters/DataVisualization.h"
#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/DataFormatters/TypeSummary.h"
+#include "lldb/Expression/REPL.h"
#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/Terminal.h"
@@ -44,6 +45,7 @@
#include "lldb/Symbol/Symbol.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/TargetList.h"
+#include "lldb/Target/Language.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/SectionLoadList.h"
@@ -1798,3 +1800,35 @@ Debugger::GetSelectedOrDummyTarget(bool prefer_dummy)
return GetDummyTarget();
}
+Error
+Debugger::RunREPL (LanguageType language, const char *repl_options)
+{
+ Error err;
+ FileSpec repl_executable;
+ if (language == eLanguageTypeUnknown)
+ {
+ err.SetErrorString ("must specify a language for a REPL"); // TODO make it possible to specify a default language
+ return err;
+ }
+
+ Target *const target = nullptr; // passing in an empty target means the REPL must create one
+
+ REPLSP repl_sp(REPL::Create(err, language, target, repl_options));
+
+ if (!err.Success())
+ {
+ return err;
+ }
+
+ if (!repl_sp)
+ {
+ err.SetErrorStringWithFormat("couldn't find a REPL for %s", Language::GetNameForLanguageType(language));
+ return err;
+ }
+
+ repl_sp->SetCompilerOptions(repl_options);
+ repl_sp->RunLoop();
+
+ return err;
+}
+
OpenPOWER on IntegriCloud