Index: include/lldb/Core/IOHandler.h =================================================================== --- include/lldb/Core/IOHandler.h +++ include/lldb/Core/IOHandler.h @@ -200,7 +200,7 @@ virtual ~IOHandlerDelegate() = default; - virtual void IOHandlerActivated(IOHandler &io_handler) {} + virtual void IOHandlerActivated(IOHandler &io_handler, bool interactive) {} virtual void IOHandlerDeactivated(IOHandler &io_handler) {} Index: include/lldb/Expression/REPL.h =================================================================== --- include/lldb/Expression/REPL.h +++ include/lldb/Expression/REPL.h @@ -85,7 +85,7 @@ //------------------------------------------------------------------ // IOHandler::Delegate functions //------------------------------------------------------------------ - void IOHandlerActivated(IOHandler &io_handler) override; + void IOHandlerActivated(IOHandler &io_handler, bool interactive) override; bool IOHandlerInterrupt(IOHandler &io_handler) override; Index: lit/Commands/command-regex-delete.test =================================================================== --- lit/Commands/command-regex-delete.test +++ lit/Commands/command-regex-delete.test @@ -2,7 +2,7 @@ # RUN: %lldb -s %s 2>&1 | FileCheck %s command regex 'Help__' -# CHECK: Enter one of more sed substitution commands in the form +# CHECK: Enter one or more sed substitution commands in the form # We need to leave a new line after to end the regex. s/^$/help/ Index: lit/Commands/command-regex-unalias.test =================================================================== --- lit/Commands/command-regex-unalias.test +++ lit/Commands/command-regex-unalias.test @@ -2,7 +2,7 @@ # RUN: %lldb -s %s 2>&1 | FileCheck %s command regex 'Help__' -# CHECK: Enter one of more sed substitution commands in the form +# CHECK: Enter one or more sed substitution commands in the form # We need to leave a new line after to end the regex. s/^$/help/ Index: source/Commands/CommandObjectBreakpointCommand.cpp =================================================================== --- source/Commands/CommandObjectBreakpointCommand.cpp +++ source/Commands/CommandObjectBreakpointCommand.cpp @@ -222,9 +222,9 @@ Options *GetOptions() override { return &m_options; } - void IOHandlerActivated(IOHandler &io_handler) override { + void IOHandlerActivated(IOHandler &io_handler, bool interactive) override { StreamFileSP output_sp(io_handler.GetOutputStreamFile()); - if (output_sp) { + if (output_sp && interactive) { output_sp->PutCString(g_reader_instructions); output_sp->Flush(); } Index: source/Commands/CommandObjectCommands.cpp =================================================================== --- source/Commands/CommandObjectCommands.cpp +++ source/Commands/CommandObjectCommands.cpp @@ -975,10 +975,10 @@ ~CommandObjectCommandsAddRegex() override = default; protected: - void IOHandlerActivated(IOHandler &io_handler) override { + void IOHandlerActivated(IOHandler &io_handler, bool interactive) override { StreamFileSP output_sp(io_handler.GetOutputStreamFile()); - if (output_sp) { - output_sp->PutCString("Enter one of more sed substitution commands in " + if (output_sp && interactive) { + output_sp->PutCString("Enter one or more sed substitution commands in " "the form: 's///'.\nTerminate the " "substitution list with an empty line.\n"); output_sp->Flush(); @@ -1634,9 +1634,9 @@ ScriptedCommandSynchronicity m_synchronicity; }; - void IOHandlerActivated(IOHandler &io_handler) override { + void IOHandlerActivated(IOHandler &io_handler, bool interactive) override { StreamFileSP output_sp(io_handler.GetOutputStreamFile()); - if (output_sp) { + if (output_sp && interactive) { output_sp->PutCString(g_python_command_instructions); output_sp->Flush(); } Index: source/Commands/CommandObjectTarget.cpp =================================================================== --- source/Commands/CommandObjectTarget.cpp +++ source/Commands/CommandObjectTarget.cpp @@ -4738,9 +4738,9 @@ Options *GetOptions() override { return &m_options; } protected: - void IOHandlerActivated(IOHandler &io_handler) override { + void IOHandlerActivated(IOHandler &io_handler, bool interactive) override { StreamFileSP output_sp(io_handler.GetOutputStreamFile()); - if (output_sp) { + if (output_sp && interactive) { output_sp->PutCString( "Enter your stop hook command(s). Type 'DONE' to end.\n"); output_sp->Flush(); Index: source/Commands/CommandObjectType.cpp =================================================================== --- source/Commands/CommandObjectType.cpp +++ source/Commands/CommandObjectType.cpp @@ -160,7 +160,7 @@ ~CommandObjectTypeSummaryAdd() override = default; - void IOHandlerActivated(IOHandler &io_handler) override { + void IOHandlerActivated(IOHandler &io_handler, bool interactive) override { static const char *g_summary_addreader_instructions = "Enter your Python command(s). Type 'DONE' to end.\n" "def function (valobj,internal_dict):\n" @@ -169,7 +169,7 @@ " internal_dict: an LLDB support object not to be used\"\"\"\n"; StreamFileSP output_sp(io_handler.GetOutputStreamFile()); - if (output_sp) { + if (output_sp && interactive) { output_sp->PutCString(g_summary_addreader_instructions); output_sp->Flush(); } @@ -412,9 +412,9 @@ } } - void IOHandlerActivated(IOHandler &io_handler) override { + void IOHandlerActivated(IOHandler &io_handler, bool interactive) override { StreamFileSP output_sp(io_handler.GetOutputStreamFile()); - if (output_sp) { + if (output_sp && interactive) { output_sp->PutCString(g_synth_addreader_instructions); output_sp->Flush(); } Index: source/Commands/CommandObjectWatchpointCommand.cpp =================================================================== --- source/Commands/CommandObjectWatchpointCommand.cpp +++ source/Commands/CommandObjectWatchpointCommand.cpp @@ -207,9 +207,9 @@ Options *GetOptions() override { return &m_options; } - void IOHandlerActivated(IOHandler &io_handler) override { + void IOHandlerActivated(IOHandler &io_handler, bool interactive) override { StreamFileSP output_sp(io_handler.GetOutputStreamFile()); - if (output_sp) { + if (output_sp && interactive) { output_sp->PutCString( "Enter your debugger command(s). Type 'DONE' to end.\n"); output_sp->Flush(); Index: source/Core/IOHandler.cpp =================================================================== --- source/Core/IOHandler.cpp +++ source/Core/IOHandler.cpp @@ -331,7 +331,7 @@ void IOHandlerEditline::Activate() { IOHandler::Activate(); - m_delegate.IOHandlerActivated(*this); + m_delegate.IOHandlerActivated(*this, GetIsInteractive()); } void IOHandlerEditline::Deactivate() { Index: source/Expression/REPL.cpp =================================================================== --- source/Expression/REPL.cpp +++ source/Expression/REPL.cpp @@ -92,7 +92,7 @@ return m_io_handler_sp; } -void REPL::IOHandlerActivated(IOHandler &io_handler) { +void REPL::IOHandlerActivated(IOHandler &io_handler, bool interactive) { lldb::ProcessSP process_sp = m_target.GetProcessSP(); if (process_sp && process_sp->IsAlive()) return; Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h =================================================================== --- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h +++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h @@ -459,7 +459,7 @@ //---------------------------------------------------------------------- // IOHandlerDelegate //---------------------------------------------------------------------- - void IOHandlerActivated(IOHandler &io_handler) override; + void IOHandlerActivated(IOHandler &io_handler, bool interactive) override; void IOHandlerInputComplete(IOHandler &io_handler, std::string &data) override; Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp =================================================================== --- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -442,7 +442,7 @@ uint32_t ScriptInterpreterPython::GetPluginVersion() { return 1; } -void ScriptInterpreterPython::IOHandlerActivated(IOHandler &io_handler) { +void ScriptInterpreterPython::IOHandlerActivated(IOHandler &io_handler, bool interactive) { const char *instructions = nullptr; switch (m_active_io_handler) { @@ -463,7 +463,7 @@ if (instructions) { StreamFileSP output_sp(io_handler.GetOutputStreamFile()); - if (output_sp) { + if (output_sp && interactive) { output_sp->PutCString(instructions); output_sp->Flush(); }