summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Interpreter')
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp30
-rw-r--r--lldb/source/Interpreter/ScriptInterpreterPython.cpp5
2 files changed, 26 insertions, 9 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index ed7e60da758..9fde66e4dba 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -40,23 +40,28 @@
#include "../Commands/CommandObjectVersion.h"
#include "../Commands/CommandObjectWatchpoint.h"
-#include "lldb/Interpreter/Args.h"
-#include "lldb/Interpreter/Options.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/InputReader.h"
+#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/Timer.h"
+
#include "lldb/Host/Host.h"
-#include "lldb/Target/Process.h"
-#include "lldb/Target/Thread.h"
-#include "lldb/Target/TargetList.h"
-#include "lldb/Utility/CleanUp.h"
+#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/ScriptInterpreterNone.h"
#include "lldb/Interpreter/ScriptInterpreterPython.h"
+
+#include "lldb/Target/Process.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/TargetList.h"
+
+#include "lldb/Utility/CleanUp.h"
+
using namespace lldb;
using namespace lldb_private;
@@ -2547,8 +2552,14 @@ CommandInterpreter::HandleCommandsFromFile (FileSpec &cmd_file,
}
ScriptInterpreter *
-CommandInterpreter::GetScriptInterpreter ()
+CommandInterpreter::GetScriptInterpreter (bool can_create)
{
+ if (m_script_interpreter_ap.get() != NULL)
+ return m_script_interpreter_ap.get();
+
+ if (!can_create)
+ return NULL;
+
// <rdar://problem/11751427>
// we need to protect the initialization of the script interpreter
// otherwise we could end up with two threads both trying to create
@@ -2559,8 +2570,9 @@ CommandInterpreter::GetScriptInterpreter ()
static Mutex g_interpreter_mutex(Mutex::eMutexTypeRecursive);
Mutex::Locker interpreter_lock(g_interpreter_mutex);
- if (m_script_interpreter_ap.get() != NULL)
- return m_script_interpreter_ap.get();
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+ if (log)
+ log->Printf("Initializing the ScriptInterpreter now\n");
lldb::ScriptLanguage script_lang = GetDebugger().GetScriptLanguage();
switch (script_lang)
diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
index fdd406a764a..9457ef9e24c 100644
--- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
@@ -501,6 +501,11 @@ ScriptInterpreterPython::ScriptInterpreterPython (CommandInterpreter &interprete
{
m_new_sysout = PyFile_FromFile (m_dbg_stdout, (char *) "", (char *) "w", _check_and_flush);
}
+
+ // get the output file handle from the debugger (if any)
+ File& out_file = interpreter.GetDebugger().GetOutputFile();
+ if (out_file.IsValid())
+ ResetOutputFileHandle(out_file.GetStream());
}
ScriptInterpreterPython::~ScriptInterpreterPython ()
OpenPOWER on IntegriCloud