summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter
diff options
context:
space:
mode:
authorCaroline Tice <ctice@apple.com>2010-09-14 22:49:06 +0000
committerCaroline Tice <ctice@apple.com>2010-09-14 22:49:06 +0000
commite7e92b771aab26471737068c4bcb0759a8b0653f (patch)
tree4d02c6013ecb05b9c0f5ee20196f1da7c3769916 /lldb/source/Interpreter
parente049051e685a57056e45ffca1b6c6317777f5768 (diff)
downloadbcm5719-llvm-e7e92b771aab26471737068c4bcb0759a8b0653f.tar.gz
bcm5719-llvm-e7e92b771aab26471737068c4bcb0759a8b0653f.zip
Remove help text that is no longer correct.
Fix Python script interpreter to not fail when the Debugger does not have input/output file handles. llvm-svn: 113880
Diffstat (limited to 'lldb/source/Interpreter')
-rw-r--r--lldb/source/Interpreter/ScriptInterpreterPython.cpp30
1 files changed, 26 insertions, 4 deletions
diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
index ffb2c9b7710..39ae32a931a 100644
--- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
@@ -298,8 +298,13 @@ ScriptInterpreterPython::InputReaderCallback
case eInputReaderActivate:
{
// Save terminal settings if we can
+ int input_fd;
FILE *input_fh = reader.GetDebugger().GetInputFileHandle();
- int input_fd = ::fileno (input_fh);
+ if (input_fh != NULL)
+ input_fd = ::fileno (input_fh);
+ else
+ input_fd = STDIN_FILENO;
+
script_interpreter->m_termios_valid = ::tcgetattr (input_fd, &script_interpreter->m_termios) == 0;
struct termios tmp_termios;
if (::tcgetattr (input_fd, &tmp_termios) == 0)
@@ -335,9 +340,14 @@ ScriptInterpreterPython::InputReaderCallback
// Restore terminal settings if they were validly saved
if (script_interpreter->m_termios_valid)
{
- ::tcsetattr (::fileno (reader.GetDebugger().GetInputFileHandle()),
- TCSANOW,
- &script_interpreter->m_termios);
+ int input_fd;
+ FILE *input_fh = reader.GetDebugger().GetInputFileHandle();
+ if (input_fh != NULL)
+ input_fd = ::fileno (input_fh);
+ else
+ input_fd = STDIN_FILENO;
+
+ ::tcsetattr (input_fd, TCSANOW, &script_interpreter->m_termios);
}
break;
}
@@ -352,6 +362,15 @@ ScriptInterpreterPython::ExecuteInterpreterLoop (CommandInterpreter &interpreter
Timer scoped_timer (__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
Debugger &debugger = interpreter.GetDebugger();
+
+ // 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 both dangerous and unnecessary (not to mention confusing) to
+ // try to embed a running interpreter loop inside the already running Python interpreter loop, so we won't
+ // do it.
+
+ if (debugger.GetInputFileHandle() == NULL)
+ return;
+
InputReaderSP reader_sp (new InputReader(debugger));
if (reader_sp)
{
@@ -556,6 +575,9 @@ ScriptInterpreterPython::GenerateBreakpointOptionsCommandCallback
static StringList commands_in_progress;
FILE *out_fh = reader.GetDebugger().GetOutputFileHandle();
+ if (out_fh == NULL)
+ out_fh = stdout;
+
switch (notification)
{
case eInputReaderActivate:
OpenPOWER on IntegriCloud