diff --git a/lldb/include/lldb/Interpreter/CommandReturnObject.h b/lldb/include/lldb/Interpreter/CommandReturnObject.h index acd03992e5e6..b922e1731d7e 100644 --- a/lldb/include/lldb/Interpreter/CommandReturnObject.h +++ b/lldb/include/lldb/Interpreter/CommandReturnObject.h @@ -160,9 +160,17 @@ public: bool HasResult (); - bool GetDidChangeProcessState (); + bool + GetDidChangeProcessState (); - void SetDidChangeProcessState (bool b); + void + SetDidChangeProcessState (bool b); + + bool + GetInteractive () const; + + void + SetInteractive (bool b); private: enum @@ -176,6 +184,7 @@ private: lldb::ReturnStatus m_status; bool m_did_change_process_state; + bool m_interactive; // If true, then the input handle from the debugger will be hooked up }; } // namespace lldb_private diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp index 388dff2a8aa3..e1adea795b08 100644 --- a/lldb/source/API/SBCommandInterpreter.cpp +++ b/lldb/source/API/SBCommandInterpreter.cpp @@ -138,6 +138,7 @@ SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnOb result.Clear(); if (command_line && m_opaque_ptr) { + result.ref().SetInteractive(false); m_opaque_ptr->HandleCommand (command_line, add_to_history ? eLazyBoolYes : eLazyBoolNo, result.ref()); } else diff --git a/lldb/source/Interpreter/CommandReturnObject.cpp b/lldb/source/Interpreter/CommandReturnObject.cpp index af9196f2894e..1b5418735069 100644 --- a/lldb/source/Interpreter/CommandReturnObject.cpp +++ b/lldb/source/Interpreter/CommandReturnObject.cpp @@ -46,7 +46,8 @@ CommandReturnObject::CommandReturnObject () : m_out_stream (), m_err_stream (), m_status (eReturnStatusStarted), - m_did_change_process_state (false) + m_did_change_process_state (false), + m_interactive (true) { } @@ -203,6 +204,7 @@ CommandReturnObject::Clear() static_cast(stream_sp.get())->Clear(); m_status = eReturnStatusStarted; m_did_change_process_state = false; + m_interactive = true; } bool @@ -217,3 +219,17 @@ CommandReturnObject::SetDidChangeProcessState (bool b) m_did_change_process_state = b; } + +bool +CommandReturnObject::GetInteractive () const +{ + return m_interactive; +} + +void +CommandReturnObject::SetInteractive (bool b) +{ + m_interactive = b; +} + + diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp index 5803fe7be252..ac4b29f1040a 100644 --- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp +++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp @@ -2438,7 +2438,7 @@ ScriptInterpreterPython::RunScriptBasedCommand(const char* impl_function, { error.SetErrorString("invalid Debugger pointer"); return false; - } + } bool ret_val = false; @@ -2446,7 +2446,7 @@ ScriptInterpreterPython::RunScriptBasedCommand(const char* impl_function, { Locker py_lock(this, - Locker::AcquireLock | Locker::InitSession, + Locker::AcquireLock | Locker::InitSession | cmd_retobj.GetInteractive() ? 0 : Locker::NoSTDIN, Locker::FreeLock | Locker::TearDownSession); SynchronicityHandler synch_handler(debugger_sp,