kastiglione updated this revision to Diff 187135.
kastiglione added a comment.
Herald added a subscriber: jdoerfert.

Add interactive parameter


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D48752/new/

https://reviews.llvm.org/D48752

Files:
  include/lldb/Core/IOHandler.h
  include/lldb/Expression/REPL.h
  lit/Commands/command-regex-delete.test
  lit/Commands/command-regex-unalias.test
  source/Commands/CommandObjectBreakpointCommand.cpp
  source/Commands/CommandObjectCommands.cpp
  source/Commands/CommandObjectTarget.cpp
  source/Commands/CommandObjectType.cpp
  source/Commands/CommandObjectWatchpointCommand.cpp
  source/Core/IOHandler.cpp
  source/Expression/REPL.cpp
  source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h

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
@@ -430,7 +430,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) {
@@ -451,7 +451,7 @@
 
   if (instructions) {
     StreamFileSP output_sp(io_handler.GetOutputStreamFile());
-    if (output_sp) {
+    if (output_sp && interactive) {
       output_sp->PutCString(instructions);
       output_sp->Flush();
     }
Index: source/Expression/REPL.cpp
===================================================================
--- source/Expression/REPL.cpp
+++ source/Expression/REPL.cpp
@@ -99,7 +99,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/Core/IOHandler.cpp
===================================================================
--- source/Core/IOHandler.cpp
+++ source/Core/IOHandler.cpp
@@ -327,7 +327,7 @@
 
 void IOHandlerEditline::Activate() {
   IOHandler::Activate();
-  m_delegate.IOHandlerActivated(*this);
+  m_delegate.IOHandlerActivated(*this, GetIsInteractive());
 }
 
 void IOHandlerEditline::Deactivate() {
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/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/CommandObjectTarget.cpp
===================================================================
--- source/Commands/CommandObjectTarget.cpp
+++ source/Commands/CommandObjectTarget.cpp
@@ -4724,9 +4724,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/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/<regex>/<subst>/'.\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/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: 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: 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: 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: include/lldb/Core/IOHandler.h
===================================================================
--- include/lldb/Core/IOHandler.h
+++ include/lldb/Core/IOHandler.h
@@ -197,7 +197,7 @@
 
   virtual ~IOHandlerDelegate() = default;
 
-  virtual void IOHandlerActivated(IOHandler &io_handler) {}
+  virtual void IOHandlerActivated(IOHandler &io_handler, bool interactive) {}
 
   virtual void IOHandlerDeactivated(IOHandler &io_handler) {}
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to