diff options
Diffstat (limited to 'lldb/source/Commands')
-rw-r--r-- | lldb/source/Commands/CommandObjectBreakpointCommand.cpp | 35 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectCommands.cpp | 20 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.cpp | 5 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectTarget.cpp | 41 |
4 files changed, 65 insertions, 36 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp index b452dbc5106..c68f54cdf25 100644 --- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp +++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp @@ -445,25 +445,29 @@ CommandObjectBreakpointCommandAdd::GenerateBreakpointCommandCallback size_t bytes_len ) { - File &out_file = reader.GetDebugger().GetOutputFile(); - + StreamSP out_stream = reader.GetDebugger().GetAsyncOutputStream(); + bool batch_mode = reader.GetDebugger().GetCommandInterpreter().GetBatchCommandMode(); + switch (notification) { case eInputReaderActivate: - out_file.Printf ("%s\n", g_reader_instructions); - if (reader.GetPrompt()) - out_file.Printf ("%s", reader.GetPrompt()); - out_file.Flush(); + if (!batch_mode) + { + out_stream->Printf ("%s\n", g_reader_instructions); + if (reader.GetPrompt()) + out_stream->Printf ("%s", reader.GetPrompt()); + out_stream->Flush(); + } break; case eInputReaderDeactivate: break; case eInputReaderReactivate: - if (reader.GetPrompt()) + if (reader.GetPrompt() && !batch_mode) { - out_file.Printf ("%s", reader.GetPrompt()); - out_file.Flush(); + out_stream->Printf ("%s", reader.GetPrompt()); + out_stream->Flush(); } break; @@ -481,10 +485,10 @@ CommandObjectBreakpointCommandAdd::GenerateBreakpointCommandCallback ((BreakpointOptions::CommandData *)bp_options_baton->m_data)->user_source.AppendString (bytes, bytes_len); } } - if (!reader.IsDone() && reader.GetPrompt()) + if (!reader.IsDone() && reader.GetPrompt() && !batch_mode) { - out_file.Printf ("%s", reader.GetPrompt()); - out_file.Flush(); + out_stream->Printf ("%s", reader.GetPrompt()); + out_stream->Flush(); } break; @@ -502,8 +506,11 @@ CommandObjectBreakpointCommandAdd::GenerateBreakpointCommandCallback ((BreakpointOptions::CommandData *) bp_options_baton->m_data)->script_source.Clear(); } } - out_file.Printf ("Warning: No command attached to breakpoint.\n"); - out_file.Flush(); + if (!batch_mode) + { + out_stream->Printf ("Warning: No command attached to breakpoint.\n"); + out_stream->Flush(); + } } break; 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; diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index 9f2e79e1a67..7d1af333d84 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -191,10 +191,12 @@ CommandObjectExpression::MultiLineExpressionCallback ) { CommandObjectExpression *cmd_object_expr = (CommandObjectExpression *) 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 expressions, then terminate with an empty line to evaluate:"); @@ -224,6 +226,7 @@ CommandObjectExpression::MultiLineExpressionCallback case eInputReaderInterrupt: cmd_object_expr->m_expr_lines.clear(); reader.SetIsDone (true); + if (!batch_mode) { StreamSP out_stream = reader.GetDebugger().GetAsyncOutputStream(); out_stream->Printf("%s\n", "Expression evaluation cancelled."); diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 1399fb0de46..3245dbb0e42 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -3075,17 +3075,21 @@ public: const char *bytes, size_t bytes_len) { - File &out_file = reader.GetDebugger().GetOutputFile(); + StreamSP out_stream = reader.GetDebugger().GetAsyncOutputStream(); Target::StopHook *new_stop_hook = ((Target::StopHook *) baton); static bool got_interrupted; + bool batch_mode = reader.GetDebugger().GetCommandInterpreter().GetBatchCommandMode(); switch (notification) { case eInputReaderActivate: - out_file.Printf ("%s\n", "Enter your stop hook command(s). Type 'DONE' to end."); - if (reader.GetPrompt()) - out_file.Printf ("%s", reader.GetPrompt()); - out_file.Flush(); + if (!batch_mode) + { + out_stream->Printf ("%s\n", "Enter your stop hook command(s). Type 'DONE' to end."); + if (reader.GetPrompt()) + out_stream->Printf ("%s", reader.GetPrompt()); + out_stream->Flush(); + } got_interrupted = false; break; @@ -3093,10 +3097,10 @@ public: break; case eInputReaderReactivate: - if (reader.GetPrompt()) + if (reader.GetPrompt() && !batch_mode) { - out_file.Printf ("%s", reader.GetPrompt()); - out_file.Flush(); + out_stream->Printf ("%s", reader.GetPrompt()); + out_stream->Flush(); } got_interrupted = false; break; @@ -3113,10 +3117,10 @@ public: commands->AppendString (bytes, bytes_len); } } - if (!reader.IsDone() && reader.GetPrompt()) + if (!reader.IsDone() && reader.GetPrompt() && !batch_mode) { - out_file.Printf ("%s", reader.GetPrompt()); - out_file.Flush(); + out_stream->Printf ("%s", reader.GetPrompt()); + out_stream->Flush(); } break; @@ -3124,8 +3128,12 @@ public: { // Finish, and cancel the stop hook. new_stop_hook->GetTarget()->RemoveStopHookByID(new_stop_hook->GetID()); - out_file.Printf ("Stop hook cancelled.\n"); - + if (!batch_mode) + { + out_stream->Printf ("Stop hook cancelled.\n"); + out_stream->Flush(); + } + reader.SetIsDone (true); } got_interrupted = true; @@ -3136,8 +3144,11 @@ public: break; case eInputReaderDone: - if (!got_interrupted) - out_file.Printf ("Stop hook #%d added.\n", new_stop_hook->GetID()); + if (!got_interrupted && !batch_mode) + { + out_stream->Printf ("Stop hook #%d added.\n", new_stop_hook->GetID()); + out_stream->Flush(); + } break; } |