Any commands that are executed through the public interface using SBCommandInterpreter::HandleCommand() are assumed to be in non-interactive mode.

Any commands that want interactivity (stdin) will need to be executed through the normal command interpreter using the debugger's in/out/err file handles, or by using "command source".

Individual commands through the API will have their STDIN disabled. The STDOUT and STDERR will be redirected into the SBCommandReturnObject argument to SBCommandInterpreter::HandleCommand() as usual.

This helps with a deadlock situation in an IDE (Xcode) where the IDE was managing the breakpoint actions by setting a breakpoint callback and doing things manually.

<rdar://problem/17386271>

llvm-svn: 213023
This commit is contained in:
Greg Clayton 2014-07-15 00:25:59 +00:00
parent 5a477c5e37
commit 45a44f3c4d
4 changed files with 31 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -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<StreamString *>(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;
}

View File

@ -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,