diff options
author | Greg Clayton <gclayton@apple.com> | 2014-03-13 23:42:30 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2014-03-13 23:42:30 +0000 |
commit | cf28a8b7cd589c3dcdd7163189e12b6c980fa474 (patch) | |
tree | 6b66970bbb498ef07a9c94245d4e04935535c9c7 /lldb/source/Commands/CommandObjectExpression.cpp | |
parent | 09f459719ed6b42eb17aadb6f438427b218bb51f (diff) | |
download | bcm5719-llvm-cf28a8b7cd589c3dcdd7163189e12b6c980fa474.tar.gz bcm5719-llvm-cf28a8b7cd589c3dcdd7163189e12b6c980fa474.zip |
Allow a multi-line expression to follow expression commands with options when there is no expression following the option terminating “—“.
llvm-svn: 203872
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(); + } } } |