diff options
Diffstat (limited to 'lldb/source/Commands/CommandObjectExpression.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.cpp | 51 |
1 files changed, 32 insertions, 19 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index 7dacaa73cd1..cd4613a10f4 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -406,6 +406,30 @@ CommandObjectExpression::IOHandlerLinesUpdated (IOHandler &io_handler, return LineStatus::Success; } +void +CommandObjectExpression::GetMultilineExpression () +{ + m_expr_lines.clear(); + m_expr_line_count = 0; + + Debugger &debugger = GetCommandInterpreter().GetDebugger(); + const bool multiple_lines = true; // Get multiple lines + IOHandlerSP io_handler_sp (new IOHandlerEditline (debugger, + "lldb-expr", // Name of input reader for history + NULL, // No prompt + multiple_lines, + 1, // Show line numbers starting at 1 + *this)); + + StreamFileSP output_sp(io_handler_sp->GetOutputStreamFile()); + if (output_sp) + { + output_sp->PutCString("Enter expressions, then terminate with an empty line to evaluate:\n"); + output_sp->Flush(); + } + debugger.PushIOHandler(io_handler_sp); +} + bool CommandObjectExpression::DoExecute ( @@ -419,25 +443,7 @@ CommandObjectExpression::DoExecute if (command[0] == '\0') { - m_expr_lines.clear(); - m_expr_line_count = 0; - - Debugger &debugger = GetCommandInterpreter().GetDebugger(); - const bool multiple_lines = true; // Get multiple lines - IOHandlerSP io_handler_sp (new IOHandlerEditline (debugger, - "lldb-expr", // Name of input reader for history - NULL, // No prompt - multiple_lines, - 1, // Show line numbers starting at 1 - *this)); - - StreamFileSP output_sp(io_handler_sp->GetOutputStreamFile()); - if (output_sp) - { - output_sp->PutCString("Enter expressions, then terminate with an empty line to evaluate:\n"); - output_sp->Flush(); - } - debugger.PushIOHandler(io_handler_sp); + GetMultilineExpression (); return result.Succeeded(); } @@ -476,6 +482,13 @@ CommandObjectExpression::DoExecute result.SetStatus (eReturnStatusFailed); return false; } + + // No expression following options + if (expr[0] == '\0') + { + GetMultilineExpression (); + return result.Succeeded(); + } } } |