summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-04-26 22:43:16 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-04-26 22:43:16 +0000
commit2b29b432d206ee706538b8dad54806d7649fb378 (patch)
treec1c288a9ee56edb568e0f4eb8925b5215ee50c97 /lldb/source/Commands
parent3bf116c1a4f88d6e3f3fd0887453dea3569e0823 (diff)
downloadbcm5719-llvm-2b29b432d206ee706538b8dad54806d7649fb378.tar.gz
bcm5719-llvm-2b29b432d206ee706538b8dad54806d7649fb378.zip
[ScriptInterpreter] Move ownership into debugger (NFC)
This is part two of the change started in r359330. This patch moves the ownership of the script interpreter from the command interpreter into the debugger. I would've preferred to remove the lazy initialization, however the fact that the scripting language is set after the debugger is created makes that tricky. So for now this does exactly the same thing as when it was under the command interpreter. The result is that this patch is fully NFC. Differential revision: https://reviews.llvm.org/D61211 llvm-svn: 359354
Diffstat (limited to 'lldb/source/Commands')
-rw-r--r--lldb/source/Commands/CommandObjectBreakpointCommand.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectCommands.cpp19
-rw-r--r--lldb/source/Commands/CommandObjectFrame.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectThread.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectType.cpp14
-rw-r--r--lldb/source/Commands/CommandObjectWatchpointCommand.cpp7
6 files changed, 23 insertions, 23 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
index 411c9ef8244..9ae1065ecfb 100644
--- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
@@ -422,7 +422,7 @@ protected:
// to set or collect command callback. Otherwise, call the methods
// associated with this object.
if (m_options.m_use_script_language) {
- ScriptInterpreter *script_interp = m_interpreter.GetScriptInterpreter();
+ ScriptInterpreter *script_interp = GetDebugger().GetScriptInterpreter();
// Special handling for one-liner specified inline.
if (m_options.m_use_one_liner) {
script_interp->SetBreakpointCommandCallback(
diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp
index dabc5c802b7..45427753b42 100644
--- a/lldb/source/Commands/CommandObjectCommands.cpp
+++ b/lldb/source/Commands/CommandObjectCommands.cpp
@@ -1246,7 +1246,7 @@ public:
if (m_fetched_help_long)
return CommandObjectRaw::GetHelpLong();
- ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter();
+ ScriptInterpreter *scripter = GetDebugger().GetScriptInterpreter();
if (!scripter)
return CommandObjectRaw::GetHelpLong();
@@ -1261,7 +1261,7 @@ public:
protected:
bool DoExecute(llvm::StringRef raw_command_line,
CommandReturnObject &result) override {
- ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter();
+ ScriptInterpreter *scripter = GetDebugger().GetScriptInterpreter();
Status error;
@@ -1304,7 +1304,7 @@ public:
StreamString stream;
stream.Printf("For more information run 'help %s'", name.c_str());
SetHelp(stream.GetString());
- if (ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter())
+ if (ScriptInterpreter *scripter = GetDebugger().GetScriptInterpreter())
GetFlags().Set(scripter->GetFlagsForCommandObject(cmd_obj_sp));
}
@@ -1319,7 +1319,7 @@ public:
llvm::StringRef GetHelp() override {
if (m_fetched_help_short)
return CommandObjectRaw::GetHelp();
- ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter();
+ ScriptInterpreter *scripter = GetDebugger().GetScriptInterpreter();
if (!scripter)
return CommandObjectRaw::GetHelp();
std::string docstring;
@@ -1335,7 +1335,7 @@ public:
if (m_fetched_help_long)
return CommandObjectRaw::GetHelpLong();
- ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter();
+ ScriptInterpreter *scripter = GetDebugger().GetScriptInterpreter();
if (!scripter)
return CommandObjectRaw::GetHelpLong();
@@ -1350,7 +1350,7 @@ public:
protected:
bool DoExecute(llvm::StringRef raw_command_line,
CommandReturnObject &result) override {
- ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter();
+ ScriptInterpreter *scripter = GetDebugger().GetScriptInterpreter();
Status error;
@@ -1489,7 +1489,7 @@ protected:
// won't stomp on each other (wrt to execution contents, options, and
// more)
m_exe_ctx.Clear();
- if (m_interpreter.GetScriptInterpreter()->LoadScriptingModule(
+ if (GetDebugger().GetScriptInterpreter()->LoadScriptingModule(
entry.c_str(), m_options.m_allow_reload, init_session, error)) {
result.SetStatus(eReturnStatusSuccessFinishNoResult);
} else {
@@ -1630,7 +1630,7 @@ protected:
std::string &data) override {
StreamFileSP error_sp = io_handler.GetErrorStreamFile();
- ScriptInterpreter *interpreter = m_interpreter.GetScriptInterpreter();
+ ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter();
if (interpreter) {
StringList lines;
@@ -1715,8 +1715,7 @@ protected:
}
}
} else {
- ScriptInterpreter *interpreter =
- GetCommandInterpreter().GetScriptInterpreter();
+ ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter();
if (!interpreter) {
result.AppendError("cannot find ScriptInterpreter");
result.SetStatus(eReturnStatusFailed);
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 9d82d7533fe..ab6a07952f1 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -890,7 +890,7 @@ bool CommandObjectFrameRecognizerAdd::DoExecute(Args &command,
return false;
}
- ScriptInterpreter *interpreter = m_interpreter.GetScriptInterpreter();
+ ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter();
if (interpreter &&
!interpreter->CheckObjectExists(m_options.m_class_name.c_str())) {
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index 1552d1a189e..e41733f2711 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -612,7 +612,7 @@ protected:
result.AppendErrorWithFormat("empty class name for scripted step.");
result.SetStatus(eReturnStatusFailed);
return false;
- } else if (!m_interpreter.GetScriptInterpreter()->CheckObjectExists(
+ } else if (!GetDebugger().GetScriptInterpreter()->CheckObjectExists(
m_options.m_class_name.c_str())) {
result.AppendErrorWithFormat(
"class for scripted step: \"%s\" does not exist.",
diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp
index 9f0770a1a56..64150f0b0bb 100644
--- a/lldb/source/Commands/CommandObjectType.cpp
+++ b/lldb/source/Commands/CommandObjectType.cpp
@@ -180,7 +180,7 @@ public:
StreamFileSP error_sp = io_handler.GetErrorStreamFile();
#ifndef LLDB_DISABLE_PYTHON
- ScriptInterpreter *interpreter = m_interpreter.GetScriptInterpreter();
+ ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter();
if (interpreter) {
StringList lines;
lines.SplitIntoLines(data);
@@ -192,7 +192,7 @@ public:
options_ptr); // this will ensure that we get rid of the pointer
// when going out of scope
- ScriptInterpreter *interpreter = m_interpreter.GetScriptInterpreter();
+ ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter();
if (interpreter) {
std::string funct_name_str;
if (interpreter->GenerateTypeScriptFunction(lines,
@@ -425,7 +425,7 @@ protected:
StreamFileSP error_sp = io_handler.GetErrorStreamFile();
#ifndef LLDB_DISABLE_PYTHON
- ScriptInterpreter *interpreter = m_interpreter.GetScriptInterpreter();
+ ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter();
if (interpreter) {
StringList lines;
lines.SplitIntoLines(data);
@@ -437,7 +437,7 @@ protected:
options_ptr); // this will ensure that we get rid of the pointer
// when going out of scope
- ScriptInterpreter *interpreter = m_interpreter.GetScriptInterpreter();
+ ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter();
if (interpreter) {
std::string class_name_str;
if (interpreter->GenerateTypeSynthClass(lines, class_name_str)) {
@@ -1346,7 +1346,7 @@ bool CommandObjectTypeSummaryAdd::Execute_ScriptSummary(
script_format = std::make_shared<ScriptSummaryFormat>(
m_options.m_flags, funct_name, code.c_str());
- ScriptInterpreter *interpreter = m_interpreter.GetScriptInterpreter();
+ ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter();
if (interpreter && !interpreter->CheckObjectExists(funct_name))
result.AppendWarningWithFormat(
@@ -1356,7 +1356,7 @@ bool CommandObjectTypeSummaryAdd::Execute_ScriptSummary(
} else if (!m_options.m_python_script
.empty()) // we have a quick 1-line script, just use it
{
- ScriptInterpreter *interpreter = m_interpreter.GetScriptInterpreter();
+ ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter();
if (!interpreter) {
result.AppendError("script interpreter missing - unable to generate "
"function wrapper.\n");
@@ -2357,7 +2357,7 @@ bool CommandObjectTypeSynthAdd::Execute_PythonClass(
entry.reset(impl);
- ScriptInterpreter *interpreter = m_interpreter.GetScriptInterpreter();
+ ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter();
if (interpreter &&
!interpreter->CheckObjectExists(impl->GetPythonClassName()))
diff --git a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp
index 29c85924c44..8894d2cea81 100644
--- a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp
+++ b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp
@@ -442,7 +442,7 @@ protected:
if (m_options.m_use_script_language) {
// Special handling for one-liner specified inline.
if (m_options.m_use_one_liner) {
- m_interpreter.GetScriptInterpreter()->SetWatchpointCommandCallback(
+ GetDebugger().GetScriptInterpreter()->SetWatchpointCommandCallback(
wp_options, m_options.m_one_liner.c_str());
}
// Special handling for using a Python function by name instead of
@@ -452,10 +452,11 @@ protected:
else if (!m_options.m_function_name.empty()) {
std::string oneliner(m_options.m_function_name);
oneliner += "(frame, wp, internal_dict)";
- m_interpreter.GetScriptInterpreter()->SetWatchpointCommandCallback(
+ GetDebugger().GetScriptInterpreter()->SetWatchpointCommandCallback(
wp_options, oneliner.c_str());
} else {
- m_interpreter.GetScriptInterpreter()
+ GetDebugger()
+ .GetScriptInterpreter()
->CollectDataForWatchpointCommandCallback(wp_options, result);
}
} else {
OpenPOWER on IntegriCloud