diff options
author | Caroline Tice <ctice@apple.com> | 2011-06-16 16:27:19 +0000 |
---|---|---|
committer | Caroline Tice <ctice@apple.com> | 2011-06-16 16:27:19 +0000 |
commit | d61c10bc79322b5c51a6facf0de490b1dcf6a809 (patch) | |
tree | 73a8aea61d3de2ce8e74caa23e216bc18ce67fa4 /lldb/source/Commands/CommandObjectCommands.cpp | |
parent | b5703510595ebf8af37e6e7a479534a01e69fccd (diff) | |
download | bcm5719-llvm-d61c10bc79322b5c51a6facf0de490b1dcf6a809.tar.gz bcm5719-llvm-d61c10bc79322b5c51a6facf0de490b1dcf6a809.zip |
Add 'batch_mode' to CommandInterpreter. Modify InputReaders to
not write output (prompts, instructions,etc.) if the CommandInterpreter
is in batch_mode.
Also, finish updating InputReaders to write to the asynchronous stream,
rather than using the Debugger's output file directly.
llvm-svn: 133162
Diffstat (limited to 'lldb/source/Commands/CommandObjectCommands.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectCommands.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index e8d43779e5f..03fa8856045 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -925,10 +925,12 @@ CommandObjectCommandsAddRegex::InputReaderCallback (void *baton, size_t bytes_len) { CommandObjectCommandsAddRegex *add_regex_cmd = (CommandObjectCommandsAddRegex *) baton; + bool batch_mode = reader.GetDebugger().GetCommandInterpreter().GetBatchCommandMode(); switch (notification) { case eInputReaderActivate: + if (!batch_mode) { StreamSP out_stream = reader.GetDebugger().GetAsyncOutputStream (); out_stream->Printf("%s\n", "Enter regular expressions in the form 's/<regex>/<subst>/' and terminate with an empty line:"); @@ -955,9 +957,12 @@ CommandObjectCommandsAddRegex::InputReaderCallback (void *baton, Error error (add_regex_cmd->AppendRegexSubstitution (bytes_strref)); if (error.Fail()) { - StreamSP out_stream = reader.GetDebugger().GetAsyncOutputStream(); - out_stream->Printf("error: %s\n", error.AsCString()); - out_stream->Flush(); + if (!batch_mode) + { + StreamSP out_stream = reader.GetDebugger().GetAsyncOutputStream(); + out_stream->Printf("error: %s\n", error.AsCString()); + out_stream->Flush(); + } add_regex_cmd->InputReaderDidCancel (); reader.SetIsDone (true); } @@ -967,9 +972,12 @@ CommandObjectCommandsAddRegex::InputReaderCallback (void *baton, case eInputReaderInterrupt: { reader.SetIsDone (true); - StreamSP out_stream = reader.GetDebugger().GetAsyncOutputStream(); - out_stream->PutCString("Regular expression command creations was cancelled.\n"); - out_stream->Flush(); + if (!batch_mode) + { + StreamSP out_stream = reader.GetDebugger().GetAsyncOutputStream(); + out_stream->PutCString("Regular expression command creations was cancelled.\n"); + out_stream->Flush(); + } add_regex_cmd->InputReaderDidCancel (); } break; |