summaryrefslogtreecommitdiff
path: root/lldb/tools/driver/Driver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/tools/driver/Driver.cpp')
-rw-r--r--lldb/tools/driver/Driver.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index a6a4a2a1b80b..a51c124f9615 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -18,6 +18,7 @@
#include "lldb/API/SBReproducer.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBStringList.h"
+#include "lldb/API/SBStructuredData.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Format.h"
@@ -201,6 +202,9 @@ SBError Driver::ProcessArgs(const opt::InputArgList &args, bool &exiting) {
if (args.hasArg(OPT_python_path)) {
m_option_data.m_print_python_path = true;
}
+ if (args.hasArg(OPT_print_script_interpreter_info)) {
+ m_option_data.m_print_script_interpreter_info = true;
+ }
if (args.hasArg(OPT_batch)) {
m_option_data.m_batch = true;
@@ -398,6 +402,22 @@ SBError Driver::ProcessArgs(const opt::InputArgList &args, bool &exiting) {
return error;
}
+ if (m_option_data.m_print_script_interpreter_info) {
+ SBStructuredData info =
+ m_debugger.GetScriptInterpreterInfo(m_debugger.GetScriptLanguage());
+ if (!info) {
+ error.SetErrorString("no script interpreter.");
+ } else {
+ SBStream stream;
+ error = info.GetAsJSON(stream);
+ if (error.Success()) {
+ llvm::outs() << stream.GetData() << '\n';
+ }
+ }
+ exiting = true;
+ return error;
+ }
+
return error;
}
@@ -609,6 +629,7 @@ int Driver::MainLoop() {
options.SetSpawnThread(false);
options.SetStopOnError(true);
options.SetStopOnCrash(m_option_data.m_batch);
+ options.SetEchoCommands(!m_option_data.m_source_quietly);
SBCommandInterpreterRunResult results =
m_debugger.RunCommandInterpreter(options);