summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ScriptInterpreter/Python
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python')
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp55
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h4
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h5
3 files changed, 29 insertions, 35 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 0482cea9558..eabbdcc373a 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -441,15 +441,13 @@ ScriptInterpreterPythonImpl::Locker::~Locker() {
DoFreeLock();
}
-ScriptInterpreterPythonImpl::ScriptInterpreterPythonImpl(
- CommandInterpreter &interpreter)
- : ScriptInterpreterPython(interpreter), m_saved_stdin(), m_saved_stdout(),
+ScriptInterpreterPythonImpl::ScriptInterpreterPythonImpl(Debugger &debugger)
+ : ScriptInterpreterPython(debugger), m_saved_stdin(), m_saved_stdout(),
m_saved_stderr(), m_main_module(),
m_session_dict(PyInitialValue::Invalid),
m_sys_module_dict(PyInitialValue::Invalid), m_run_one_line_function(),
m_run_one_line_str_global(),
- m_dictionary_name(
- interpreter.GetDebugger().GetInstanceName().AsCString()),
+ m_dictionary_name(m_debugger.GetInstanceName().AsCString()),
m_terminal_state(), m_active_io_handler(eIOHandlerNone),
m_session_is_active(false), m_pty_slave_is_open(false),
m_valid_session(true), m_lock_count(0), m_command_thread_state(nullptr) {
@@ -495,8 +493,7 @@ ScriptInterpreterPythonImpl::ScriptInterpreterPythonImpl(
run_string.Printf("run_one_line (%s, 'lldb.debugger_unique_id = %" PRIu64
"; pydoc.pager = pydoc.plainpager')",
- m_dictionary_name.c_str(),
- interpreter.GetDebugger().GetID());
+ m_dictionary_name.c_str(), m_debugger.GetID());
PyRun_SimpleString(run_string.GetData());
}
@@ -549,7 +546,7 @@ def function (frame, bp_loc, internal_dict):
void ScriptInterpreterPythonImpl::IOHandlerInputComplete(IOHandler &io_handler,
std::string &data) {
io_handler.SetIsDone(true);
- bool batch_mode = m_interpreter.GetBatchCommandMode();
+ bool batch_mode = m_debugger.GetCommandInterpreter().GetBatchCommandMode();
switch (m_active_io_handler) {
case eIOHandlerNone:
@@ -608,8 +605,8 @@ void ScriptInterpreterPythonImpl::IOHandlerInputComplete(IOHandler &io_handler,
}
lldb::ScriptInterpreterSP
-ScriptInterpreterPythonImpl::CreateInstance(CommandInterpreter &interpreter) {
- return std::make_shared<ScriptInterpreterPythonImpl>(interpreter);
+ScriptInterpreterPythonImpl::CreateInstance(Debugger &debugger) {
+ return std::make_shared<ScriptInterpreterPythonImpl>(debugger);
}
void ScriptInterpreterPythonImpl::ResetOutputFileHandle(FILE *fh) {}
@@ -711,11 +708,10 @@ bool ScriptInterpreterPythonImpl::EnterSession(uint16_t on_entry_flags,
if (on_entry_flags & Locker::InitGlobals) {
run_string.Printf("run_one_line (%s, 'lldb.debugger_unique_id = %" PRIu64,
- m_dictionary_name.c_str(),
- GetCommandInterpreter().GetDebugger().GetID());
+ m_dictionary_name.c_str(), m_debugger.GetID());
run_string.Printf(
"; lldb.debugger = lldb.SBDebugger.FindDebuggerWithID (%" PRIu64 ")",
- GetCommandInterpreter().GetDebugger().GetID());
+ m_debugger.GetID());
run_string.PutCString("; lldb.target = lldb.debugger.GetSelectedTarget()");
run_string.PutCString("; lldb.process = lldb.target.GetProcess()");
run_string.PutCString("; lldb.thread = lldb.process.GetSelectedThread ()");
@@ -725,11 +721,10 @@ bool ScriptInterpreterPythonImpl::EnterSession(uint16_t on_entry_flags,
// If we aren't initing the globals, we should still always set the
// debugger (since that is always unique.)
run_string.Printf("run_one_line (%s, 'lldb.debugger_unique_id = %" PRIu64,
- m_dictionary_name.c_str(),
- GetCommandInterpreter().GetDebugger().GetID());
+ m_dictionary_name.c_str(), m_debugger.GetID());
run_string.Printf(
"; lldb.debugger = lldb.SBDebugger.FindDebuggerWithID (%" PRIu64 ")",
- GetCommandInterpreter().GetDebugger().GetID());
+ m_debugger.GetID());
run_string.PutCString("')");
}
@@ -746,8 +741,7 @@ bool ScriptInterpreterPythonImpl::EnterSession(uint16_t on_entry_flags,
lldb::StreamFileSP out_sp;
lldb::StreamFileSP err_sp;
if (!in_file.IsValid() || !out_file.IsValid() || !err_file.IsValid())
- m_interpreter.GetDebugger().AdoptTopIOHandlerFilesIfInvalid(in_sp, out_sp,
- err_sp);
+ m_debugger.AdoptTopIOHandlerFilesIfInvalid(in_sp, out_sp, err_sp);
if (on_entry_flags & Locker::NoSTDIN) {
m_saved_stdin.Reset();
@@ -871,7 +865,7 @@ bool ScriptInterpreterPythonImpl::ExecuteOneLine(
// another string to pass to PyRun_SimpleString messes up the escaping. So
// we use the following more complicated method to pass the command string
// directly down to Python.
- Debugger &debugger = m_interpreter.GetDebugger();
+ Debugger &debugger = m_debugger;
StreamFileSP input_file_sp;
StreamFileSP output_file_sp;
@@ -1018,7 +1012,7 @@ void ScriptInterpreterPythonImpl::ExecuteInterpreterLoop() {
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
- Debugger &debugger = GetCommandInterpreter().GetDebugger();
+ Debugger &debugger = m_debugger;
// At the moment, the only time the debugger does not have an input file
// handle is when this is called directly from Python, in which case it is
@@ -1274,14 +1268,15 @@ void ScriptInterpreterPythonImpl::CollectDataForBreakpointCommandCallback(
std::vector<BreakpointOptions *> &bp_options_vec,
CommandReturnObject &result) {
m_active_io_handler = eIOHandlerBreakpoint;
- m_interpreter.GetPythonCommandsFromIOHandler(" ", *this, true,
- &bp_options_vec);
+ m_debugger.GetCommandInterpreter().GetPythonCommandsFromIOHandler(
+ " ", *this, true, &bp_options_vec);
}
void ScriptInterpreterPythonImpl::CollectDataForWatchpointCommandCallback(
WatchpointOptions *wp_options, CommandReturnObject &result) {
m_active_io_handler = eIOHandlerWatchpoint;
- m_interpreter.GetPythonCommandsFromIOHandler(" ", *this, true, wp_options);
+ m_debugger.GetCommandInterpreter().GetPythonCommandsFromIOHandler(
+ " ", *this, true, wp_options);
}
void ScriptInterpreterPythonImpl::SetBreakpointCommandCallbackFunction(
@@ -1290,8 +1285,9 @@ void ScriptInterpreterPythonImpl::SetBreakpointCommandCallbackFunction(
std::string oneliner("return ");
oneliner += function_name;
oneliner += "(frame, bp_loc, internal_dict)";
- m_interpreter.GetScriptInterpreter()->SetBreakpointCommandCallback(
- bp_options, oneliner.c_str());
+ m_debugger.GetCommandInterpreter()
+ .GetScriptInterpreter()
+ ->SetBreakpointCommandCallback(bp_options, oneliner.c_str());
}
Status ScriptInterpreterPythonImpl::SetBreakpointCommandCallback(
@@ -2109,8 +2105,7 @@ ScriptInterpreterPythonImpl::CreateSyntheticScriptedProvider(
StructuredData::GenericSP
ScriptInterpreterPythonImpl::CreateScriptCommandObject(const char *class_name) {
- DebuggerSP debugger_sp(
- GetCommandInterpreter().GetDebugger().shared_from_this());
+ DebuggerSP debugger_sp(m_debugger.shared_from_this());
if (class_name == nullptr || class_name[0] == '\0')
return StructuredData::GenericSP();
@@ -2718,7 +2713,7 @@ bool ScriptInterpreterPythonImpl::LoadScriptingModule(
return false;
}
- lldb::DebuggerSP debugger_sp = m_interpreter.GetDebugger().shared_from_this();
+ lldb::DebuggerSP debugger_sp = m_debugger.shared_from_this();
{
FileSpec target_file(pathname);
@@ -2912,7 +2907,7 @@ bool ScriptInterpreterPythonImpl::RunScriptBasedCommand(
return false;
}
- lldb::DebuggerSP debugger_sp = m_interpreter.GetDebugger().shared_from_this();
+ lldb::DebuggerSP debugger_sp = m_debugger.shared_from_this();
lldb::ExecutionContextRefSP exe_ctx_ref_sp(new ExecutionContextRef(exe_ctx));
if (!debugger_sp.get()) {
@@ -2956,7 +2951,7 @@ bool ScriptInterpreterPythonImpl::RunScriptBasedCommand(
return false;
}
- lldb::DebuggerSP debugger_sp = m_interpreter.GetDebugger().shared_from_this();
+ lldb::DebuggerSP debugger_sp = m_debugger.shared_from_this();
lldb::ExecutionContextRefSP exe_ctx_ref_sp(new ExecutionContextRef(exe_ctx));
if (!debugger_sp.get()) {
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
index 6a07be86071..24941ec7745 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
@@ -36,8 +36,8 @@ public:
}
};
- ScriptInterpreterPython(CommandInterpreter &interpreter)
- : ScriptInterpreter(interpreter, lldb::eScriptLanguagePython),
+ ScriptInterpreterPython(Debugger &debugger)
+ : ScriptInterpreter(debugger, lldb::eScriptLanguagePython),
IOHandlerDelegateMultiline("DONE") {}
static void Initialize();
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
index 7a0cf7403d4..a9993c4068a 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
@@ -29,7 +29,7 @@ class ScriptInterpreterPythonImpl : public ScriptInterpreterPython {
public:
friend class IOHandlerPythonInterpreter;
- ScriptInterpreterPythonImpl(CommandInterpreter &interpreter);
+ ScriptInterpreterPythonImpl(Debugger &debugger);
~ScriptInterpreterPythonImpl() override;
@@ -273,8 +273,7 @@ public:
void IOHandlerInputComplete(IOHandler &io_handler,
std::string &data) override;
- static lldb::ScriptInterpreterSP
- CreateInstance(CommandInterpreter &interpreter);
+ static lldb::ScriptInterpreterSP CreateInstance(Debugger &debugger);
// PluginInterface protocol
lldb_private::ConstString GetPluginName() override;
OpenPOWER on IntegriCloud