summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/API/SBCommandInterpreter.h6
-rw-r--r--lldb/include/lldb/Interpreter/ScriptInterpreter.h12
-rw-r--r--lldb/scripts/Python/interface/SBCommandInterpreter.i8
-rw-r--r--lldb/source/API/SBCommandInterpreter.cpp26
-rw-r--r--lldb/source/Interpreter/ScriptInterpreter.cpp23
-rw-r--r--lldb/source/Interpreter/ScriptInterpreterPython.cpp25
6 files changed, 5 insertions, 95 deletions
diff --git a/lldb/include/lldb/API/SBCommandInterpreter.h b/lldb/include/lldb/API/SBCommandInterpreter.h
index 71a157de3a5..a33ff2dc8a9 100644
--- a/lldb/include/lldb/API/SBCommandInterpreter.h
+++ b/lldb/include/lldb/API/SBCommandInterpreter.h
@@ -65,12 +65,6 @@ public:
lldb::SBProcess
GetProcess ();
- ssize_t
- WriteToScriptInterpreter (const char *src);
-
- ssize_t
- WriteToScriptInterpreter (const char *src, size_t src_len);
-
void
SourceInitFileInHomeDirectory (lldb::SBCommandReturnObject &result);
diff --git a/lldb/include/lldb/Interpreter/ScriptInterpreter.h b/lldb/include/lldb/Interpreter/ScriptInterpreter.h
index 8ca845adafb..223c2666881 100644
--- a/lldb/include/lldb/Interpreter/ScriptInterpreter.h
+++ b/lldb/include/lldb/Interpreter/ScriptInterpreter.h
@@ -240,18 +240,6 @@ public:
protected:
CommandInterpreter &m_interpreter;
lldb::ScriptLanguage m_script_lang;
-
- // Scripting languages may need to use stdin for their interactive loops;
- // however we don't want them to grab the real system stdin because that
- // resource needs to be shared among the debugger UI, the inferior process and these
- // embedded scripting loops. Therefore we need to set up a pseudoterminal and use that
- // as stdin for the script interpreter interactive loops/prompts.
-
- lldb_utility::PseudoTerminal m_interpreter_pty; // m_session_pty
- std::string m_pty_slave_name; //m_session_pty_slave_name
-
-private:
-
};
} // namespace lldb_private
diff --git a/lldb/scripts/Python/interface/SBCommandInterpreter.i b/lldb/scripts/Python/interface/SBCommandInterpreter.i
index ec9e51c561a..1f15a98e49a 100644
--- a/lldb/scripts/Python/interface/SBCommandInterpreter.i
+++ b/lldb/scripts/Python/interface/SBCommandInterpreter.i
@@ -99,14 +99,6 @@ public:
lldb::SBProcess
GetProcess ();
-#if 0
- ssize_t
- WriteToScriptInterpreter (const char *src);
-#endif
-
- ssize_t
- WriteToScriptInterpreter (const char *src, size_t src_len);
-
void
SourceInitFileInHomeDirectory (lldb::SBCommandReturnObject &result);
diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp
index 03f33c69db0..7fbf5c2c73d 100644
--- a/lldb/source/API/SBCommandInterpreter.cpp
+++ b/lldb/source/API/SBCommandInterpreter.cpp
@@ -208,32 +208,6 @@ SBCommandInterpreter::GetProcess ()
return process;
}
-ssize_t
-SBCommandInterpreter::WriteToScriptInterpreter (const char *src)
-{
- return WriteToScriptInterpreter (src, strlen(src));
-}
-
-ssize_t
-SBCommandInterpreter::WriteToScriptInterpreter (const char *src, size_t src_len)
-{
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
- ssize_t bytes_written = 0;
- if (m_opaque_ptr && src && src[0])
- {
- ScriptInterpreter *script_interpreter = m_opaque_ptr->GetScriptInterpreter();
- if (script_interpreter)
- bytes_written = ::write (script_interpreter->GetMasterFileDescriptor(), src, src_len);
- }
- if (log)
- log->Printf ("SBCommandInterpreter(%p)::WriteToScriptInterpreter (src=\"%s\", src_len=%zu) => %zi",
- m_opaque_ptr, src, src_len, bytes_written);
-
- return bytes_written;
-}
-
-
CommandInterpreter *
SBCommandInterpreter::get ()
{
diff --git a/lldb/source/Interpreter/ScriptInterpreter.cpp b/lldb/source/Interpreter/ScriptInterpreter.cpp
index eb7ddc29d54..826a0021e7e 100644
--- a/lldb/source/Interpreter/ScriptInterpreter.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreter.cpp
@@ -25,21 +25,12 @@ using namespace lldb_private;
ScriptInterpreter::ScriptInterpreter (CommandInterpreter &interpreter, lldb::ScriptLanguage script_lang) :
m_interpreter (interpreter),
- m_script_lang (script_lang),
- m_interpreter_pty (),
- m_pty_slave_name ()
+ m_script_lang (script_lang)
{
- if (m_interpreter_pty.OpenFirstAvailableMaster (O_RDWR|O_NOCTTY, NULL, 0))
- {
- const char *slave_name = m_interpreter_pty.GetSlaveName(NULL, 0);
- if (slave_name)
- m_pty_slave_name.assign(slave_name);
- }
}
ScriptInterpreter::~ScriptInterpreter ()
{
- m_interpreter_pty.CloseMasterFileDescriptor();
}
CommandInterpreter &
@@ -48,18 +39,6 @@ ScriptInterpreter::GetCommandInterpreter ()
return m_interpreter;
}
-const char *
-ScriptInterpreter::GetScriptInterpreterPtyName ()
-{
- return m_pty_slave_name.c_str();
-}
-
-int
-ScriptInterpreter::GetMasterFileDescriptor ()
-{
- return m_interpreter_pty.GetMasterFileDescriptor();
-}
-
void
ScriptInterpreter::CollectDataForBreakpointCommandCallback
(
diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
index ee3f14c8e62..2e950173b91 100644
--- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
@@ -187,7 +187,6 @@ ScriptInterpreterPython::ScriptInterpreterPython (CommandInterpreter &interprete
m_dictionary_name (interpreter.GetDebugger().GetInstanceName().AsCString()),
m_terminal_state (),
m_session_is_active (false),
- m_pty_slave_is_open (false),
m_valid_session (true)
{
@@ -262,7 +261,6 @@ ScriptInterpreterPython::~ScriptInterpreterPython ()
{
m_embedded_thread_input_reader_sp->SetIsDone (true);
m_embedded_python_pty.CloseSlaveFileDescriptor();
- m_pty_slave_is_open = false;
const InputReaderSP reader_sp = m_embedded_thread_input_reader_sp;
m_embedded_thread_input_reader_sp.reset();
debugger.PopInputReader (reader_sp);
@@ -348,14 +346,14 @@ ScriptInterpreterPython::EnterSession ()
run_string.Printf ("run_one_line (%s, 'lldb.target = lldb.debugger.GetSelectedTarget()')",
m_dictionary_name.c_str());
else
- run_string.Printf ("run_one_line (%s, 'lldb.target = None')", m_dictionary_name.c_str());
+ run_string.Printf ("run_one_line (%s, 'lldb.target = lldb.SBTarget()')", m_dictionary_name.c_str());
PyRun_SimpleString (run_string.GetData());
run_string.Clear();
if (exe_ctx.GetProcessPtr())
run_string.Printf ("run_one_line (%s, 'lldb.process = lldb.target.GetProcess()')", m_dictionary_name.c_str());
else
- run_string.Printf ("run_one_line (%s, 'lldb.process = None')", m_dictionary_name.c_str());
+ run_string.Printf ("run_one_line (%s, 'lldb.process = lldb.SBProcess()')", m_dictionary_name.c_str());
PyRun_SimpleString (run_string.GetData());
run_string.Clear();
@@ -363,7 +361,7 @@ ScriptInterpreterPython::EnterSession ()
run_string.Printf ("run_one_line (%s, 'lldb.thread = lldb.process.GetSelectedThread ()')",
m_dictionary_name.c_str());
else
- run_string.Printf ("run_one_line (%s, 'lldb.thread = None')", m_dictionary_name.c_str());
+ run_string.Printf ("run_one_line (%s, 'lldb.thread = lldb.SBThread()')", m_dictionary_name.c_str());
PyRun_SimpleString (run_string.GetData());
run_string.Clear();
@@ -371,7 +369,7 @@ ScriptInterpreterPython::EnterSession ()
run_string.Printf ("run_one_line (%s, 'lldb.frame = lldb.thread.GetSelectedFrame ()')",
m_dictionary_name.c_str());
else
- run_string.Printf ("run_one_line (%s, 'lldb.frame = None')", m_dictionary_name.c_str());
+ run_string.Printf ("run_one_line (%s, 'lldb.frame = lldb.SBFrame()')", m_dictionary_name.c_str());
PyRun_SimpleString (run_string.GetData());
run_string.Clear();
@@ -385,19 +383,6 @@ ScriptInterpreterPython::EnterSession ()
if (PyErr_Occurred())
PyErr_Clear ();
-
- if (!m_pty_slave_is_open)
- {
- run_string.Clear();
- run_string.Printf ("run_one_line (%s, \"new_stdin = open('%s', 'r')\")", m_dictionary_name.c_str(),
- m_pty_slave_name.c_str());
- PyRun_SimpleString (run_string.GetData());
- m_pty_slave_is_open = true;
-
- run_string.Clear();
- run_string.Printf ("run_one_line (%s, 'sys.stdin = new_stdin')", m_dictionary_name.c_str());
- PyRun_SimpleString (run_string.GetData());
- }
}
@@ -1651,8 +1636,6 @@ ScriptInterpreterPython::RunEmbeddedPythonInterpreter (lldb::thread_arg_t baton)
script_interpreter->m_embedded_python_pty.CloseSlaveFileDescriptor();
- script_interpreter->m_pty_slave_is_open = false;
-
log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_SCRIPT);
if (log)
log->Printf ("%p ScriptInterpreterPython::RunEmbeddedPythonInterpreter () thread exiting...", baton);
OpenPOWER on IntegriCloud