[Lldb-commits] [PATCH] D48752: Quiet command regex instructions during batch execution

2019-03-10 Thread Dave Lee via Phabricator via lldb-commits
kastiglione added a comment.

Thanks for reviewing @clayborg.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D48752



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D48752: Quiet command regex instructions during batch execution

2019-03-10 Thread Dave Lee via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB355793: Quiet command regex instructions during batch 
execution (authored by kastiglione, committed by ).
Herald added a subscriber: abidh.
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D48752?vs=187135=190030#toc

Repository:
  rLLDB LLDB

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 _handler) override;
+  void IOHandlerActivated(IOHandler _handler, bool interactive) override;
 
   void IOHandlerInputComplete(IOHandler _handler,
   std::string ) 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 _handler) {
+void ScriptInterpreterPython::IOHandlerActivated(IOHandler _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();
 }
Index: source/Commands/CommandObjectBreakpointCommand.cpp
===
--- source/Commands/CommandObjectBreakpointCommand.cpp
+++ source/Commands/CommandObjectBreakpointCommand.cpp
@@ -222,9 +222,9 @@
 
   Options *GetOptions() override { return _options; }
 
-  void IOHandlerActivated(IOHandler _handler) override {
+  void IOHandlerActivated(IOHandler _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/CommandObjectType.cpp
===
--- source/Commands/CommandObjectType.cpp
+++ source/Commands/CommandObjectType.cpp
@@ -160,7 +160,7 @@
 
   ~CommandObjectTypeSummaryAdd() override = default;
 
-  void IOHandlerActivated(IOHandler _handler) override {
+  void IOHandlerActivated(IOHandler _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 _handler) override {
+  void IOHandlerActivated(IOHandler _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 _options; }
 
-  void IOHandlerActivated(IOHandler _handler) override {
+  void IOHandlerActivated(IOHandler 

[Lldb-commits] [PATCH] D48752: Quiet command regex instructions during batch execution

2019-02-27 Thread Dave Lee via Phabricator via lldb-commits
kastiglione added a comment.

@clayborg this has been updated the approach you suggested, adding an 
`interactive` parameter.


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

https://reviews.llvm.org/D48752



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D48752: Quiet command regex instructions during batch execution

2019-02-16 Thread Dave Lee via Phabricator via lldb-commits
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 _handler) override;
+  void IOHandlerActivated(IOHandler _handler, bool interactive) override;
 
   void IOHandlerInputComplete(IOHandler _handler,
   std::string ) 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 _handler) {
+void ScriptInterpreterPython::IOHandlerActivated(IOHandler _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 _handler) {
+void REPL::IOHandlerActivated(IOHandler _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 _options; }
 
-  void IOHandlerActivated(IOHandler _handler) override {
+  void IOHandlerActivated(IOHandler _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 _handler) override {
+  void IOHandlerActivated(IOHandler _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 _handler) override {
+  void IOHandlerActivated(IOHandler _handler, bool 

[Lldb-commits] [PATCH] D48752: Quiet command regex instructions during batch execution

2018-11-28 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Seems like we should just add a "bool interactive" as a second parameter to 
"IOHandlerActivated". Then it will be easy to find the other places that need 
to be fixed up.




Comment at: include/lldb/Core/IOHandler.h:201
 
   virtual void IOHandlerActivated(IOHandler _handler) {}
 

Maybe remove the function below and add a "bool interactive" as a second 
parameter to this function?



Comment at: source/Commands/CommandObjectCommands.cpp:983
 protected:
-  void IOHandlerActivated(IOHandler _handler) override {
+  void IOHandlerActivatedInteractively(IOHandler _handler) override {
 StreamFileSP output_sp(io_handler.GetOutputStreamFile());

See above inline comment about leaving the name the same but adding the "bool 
interactive" as a paramter



Comment at: source/Commands/CommandObjectCommands.cpp:985
 StreamFileSP output_sp(io_handler.GetOutputStreamFile());
 if (output_sp) {
+  output_sp->PutCString("Enter one or more sed substitution commands in "

If we make changes I requested above this would become:
```
if (output_sp && interactive)
```



Comment at: source/Core/IOHandler.cpp:335-337
   m_delegate.IOHandlerActivated(*this);
+  if (GetIsInteractive())
+m_delegate.IOHandlerActivatedInteractively(*this);

```
m_delegate. IOHandlerActivated(*this, GetIsInteractive());
```


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

https://reviews.llvm.org/D48752



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D48752: Quiet command regex instructions during batch execution

2018-11-27 Thread Dave Lee via Phabricator via lldb-commits
kastiglione added a comment.

@jingham If you're still willing to review this change to `command regex`, it 
is updated per our previous discussion, thanks.


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

https://reviews.llvm.org/D48752



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D48752: Quiet command regex instructions during batch execution

2018-11-03 Thread Dave Lee via Phabricator via lldb-commits
kastiglione added a comment.

There are other commands that print instructions in the same way that `command 
regex` does, should they be updated in this change too?


https://reviews.llvm.org/D48752



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D48752: Quiet command regex instructions during batch execution

2018-11-03 Thread Dave Lee via Phabricator via lldb-commits
kastiglione updated this revision to Diff 172488.
kastiglione added a comment.

Added IOHandlerActivatedInteractively


https://reviews.llvm.org/D48752

Files:
  include/lldb/Core/IOHandler.h
  
packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py
  source/Commands/CommandObjectCommands.cpp
  source/Core/IOHandler.cpp


Index: source/Core/IOHandler.cpp
===
--- source/Core/IOHandler.cpp
+++ source/Core/IOHandler.cpp
@@ -333,6 +333,8 @@
 void IOHandlerEditline::Activate() {
   IOHandler::Activate();
   m_delegate.IOHandlerActivated(*this);
+  if (GetIsInteractive())
+m_delegate.IOHandlerActivatedInteractively(*this);
 }
 
 void IOHandlerEditline::Deactivate() {
Index: source/Commands/CommandObjectCommands.cpp
===
--- source/Commands/CommandObjectCommands.cpp
+++ source/Commands/CommandObjectCommands.cpp
@@ -980,10 +980,10 @@
   ~CommandObjectCommandsAddRegex() override = default;
 
 protected:
-  void IOHandlerActivated(IOHandler _handler) override {
+  void IOHandlerActivatedInteractively(IOHandler _handler) override {
 StreamFileSP output_sp(io_handler.GetOutputStreamFile());
 if (output_sp) {
-  output_sp->PutCString("Enter one of more sed substitution commands in "
+  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();
Index: 
packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py
===
--- 
packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py
+++ 
packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py
@@ -24,7 +24,7 @@
 """Test a simple scenario of 'command regex' invocation and subsequent 
use."""
 import pexpect
 prompt = "(lldb) "
-regex_prompt = "Enter one of more sed substitution commands in the 
form: 's///'.\r\nTerminate the substitution list with an empty 
line.\r\n"
+regex_prompt = "Enter one or more sed substitution commands in the 
form: 's///'.\r\nTerminate the substitution list with an empty 
line.\r\n"
 regex_prompt1 = "\r\n"
 
 child = pexpect.spawn('%s %s' %
Index: include/lldb/Core/IOHandler.h
===
--- include/lldb/Core/IOHandler.h
+++ include/lldb/Core/IOHandler.h
@@ -200,6 +200,8 @@
 
   virtual void IOHandlerActivated(IOHandler _handler) {}
 
+  virtual void IOHandlerActivatedInteractively(IOHandler _handler) {}
+
   virtual void IOHandlerDeactivated(IOHandler _handler) {}
 
   virtual int IOHandlerComplete(IOHandler _handler, const char 
*current_line,


Index: source/Core/IOHandler.cpp
===
--- source/Core/IOHandler.cpp
+++ source/Core/IOHandler.cpp
@@ -333,6 +333,8 @@
 void IOHandlerEditline::Activate() {
   IOHandler::Activate();
   m_delegate.IOHandlerActivated(*this);
+  if (GetIsInteractive())
+m_delegate.IOHandlerActivatedInteractively(*this);
 }
 
 void IOHandlerEditline::Deactivate() {
Index: source/Commands/CommandObjectCommands.cpp
===
--- source/Commands/CommandObjectCommands.cpp
+++ source/Commands/CommandObjectCommands.cpp
@@ -980,10 +980,10 @@
   ~CommandObjectCommandsAddRegex() override = default;
 
 protected:
-  void IOHandlerActivated(IOHandler _handler) override {
+  void IOHandlerActivatedInteractively(IOHandler _handler) override {
 StreamFileSP output_sp(io_handler.GetOutputStreamFile());
 if (output_sp) {
-  output_sp->PutCString("Enter one of more sed substitution commands in "
+  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();
Index: packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py
===
--- packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py
+++ packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py
@@ -24,7 +24,7 @@
 """Test a simple scenario of 'command regex' invocation and subsequent use."""
 import pexpect
 prompt = "(lldb) "
-regex_prompt = "Enter one of more sed substitution commands in the form: 's///'.\r\nTerminate the substitution list with an empty line.\r\n"
+regex_prompt = "Enter one or more sed substitution commands in the form: 's///'.\r\nTerminate the substitution list with an empty line.\r\n"
 

[Lldb-commits] [PATCH] D48752: Quiet command regex instructions during batch execution

2018-07-02 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a subscriber: kastiglione.
jingham added a comment.

Sure, that also sounds fine.

Jim


https://reviews.llvm.org/D48752



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D48752: Quiet command regex instructions during batch execution

2018-07-02 Thread Jim Ingham via lldb-commits
Sure, that also sounds fine.

Jim


> On Jun 29, 2018, at 11:55 AM, Dave Lee via Phabricator 
>  wrote:
> 
> kastiglione added a comment.
> 
> Thanks @jingham.
> 
>> if the `IOHandlerDelegate` could say whether it wants to be notified for 
>> `IOHandlerActivated` when non-interactive (like have a 
>> "`ShouldNotifyWhenNonInteractive`" method), and then the `IOHandler` could 
>> dispatch it or not based on the response to that method
> 
> So the "`ShouldNotifyWhenNonInteractive`" would only control whether 
> `IOHandlerActivated` is called, not any of the other `IOHandlerDelegate` 
> methods?
> 
> What do you think about adding a `IOHandlerActivatedInteractively`delegate 
> method? This could be called in addition to 
> `IOHandlerActivatedInteractively`, but only for interactive IO?
> 
> 
> https://reviews.llvm.org/D48752
> 
> 
> 

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D48752: Quiet command regex instructions during batch execution

2018-07-02 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: source/Commands/CommandObjectCommands.cpp:1012
   void IOHandlerActivated(IOHandler _handler) override {
+if (!io_handler.GetIsInteractive() && !io_handler.GetIsRealTerminal())
+  // Don't print instructions during batch execution, such as .lldbinit.

Why do we need to check for a real terminal here? Isn't checking if it is 
interactive enough?


https://reviews.llvm.org/D48752



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D48752: Quiet command regex instructions during batch execution

2018-06-29 Thread Dave Lee via Phabricator via lldb-commits
kastiglione added a comment.

Thanks @jingham.

> if the `IOHandlerDelegate` could say whether it wants to be notified for 
> `IOHandlerActivated` when non-interactive (like have a 
> "`ShouldNotifyWhenNonInteractive`" method), and then the `IOHandler` could 
> dispatch it or not based on the response to that method

So the "`ShouldNotifyWhenNonInteractive`" would only control whether 
`IOHandlerActivated` is called, not any of the other `IOHandlerDelegate` 
methods?

What do you think about adding a `IOHandlerActivatedInteractively`delegate 
method? This could be called in addition to `IOHandlerActivatedInteractively`, 
but only for interactive IO?


https://reviews.llvm.org/D48752



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D48752: Quiet command regex instructions during batch execution

2018-06-28 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

This behavior change seems desirable.  But there are other commands that use 
the IOHandlerActivated method to print instructions like this, and should get 
the same treatment (breakpoint command add, type summary add...).  It seems 
ugly to have to do this one by one in individual commands.

The IOHandlerDelegate is a pretty general class, so I don't think it is right 
for the IOHandler to only dispatch "IOHandlerActivated" to it when interactive. 
 There's no requirement that the work you do in this method is only useful when 
interactive.  But it might work if the IOHandlerDelegate could say whether it 
wants to be notified for IOHandlerActivated when non-interactive (like have a 
"ShouldNotifyWhenNonInteractive" method), and then the IOHandler could dispatch 
it or not based on the response to that method.


https://reviews.llvm.org/D48752



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D48752: Quiet command regex instructions during batch execution

2018-06-28 Thread Dave Lee via Phabricator via lldb-commits
kastiglione created this revision.
kastiglione added reviewers: clayborg, jingham.

Within .lldbinit, regex commands can be structured as a list of substitutions 
over
multiple lines. It's possible that this is uninentional, but it works and has
benefits.

For example:

  command regex 
  s/pat1/repl1/
  s/pat2/repl2/
  ...


I use this form of `command regex` in my `~/.lldbinit`, because it makes it
clearer to write and read compared to a single line definition, because
multiline substitutions don't need to be quoted, and are broken up one per line.

However, multiline definitions result in usage instructions being printed for
each use. The result is that every time I run `lldb`, I get a dozen or more
lines of noise. With this change, the instructions are only printed when
`command regex` is invoked interactively, or from a terminal, neither of which
are true when lldb is sourcing `~/.lldbinit`.


https://reviews.llvm.org/D48752

Files:
  
packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py
  source/Commands/CommandObjectCommands.cpp


Index: source/Commands/CommandObjectCommands.cpp
===
--- source/Commands/CommandObjectCommands.cpp
+++ source/Commands/CommandObjectCommands.cpp
@@ -1009,9 +1009,12 @@
 
 protected:
   void IOHandlerActivated(IOHandler _handler) override {
+if (!io_handler.GetIsInteractive() && !io_handler.GetIsRealTerminal())
+  // Don't print instructions during batch execution, such as .lldbinit.
+  return;
 StreamFileSP output_sp(io_handler.GetOutputStreamFile());
 if (output_sp) {
-  output_sp->PutCString("Enter one of more sed substitution commands in "
+  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();
Index: 
packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py
===
--- 
packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py
+++ 
packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py
@@ -24,7 +24,7 @@
 """Test a simple scenario of 'command regex' invocation and subsequent 
use."""
 import pexpect
 prompt = "(lldb) "
-regex_prompt = "Enter one of more sed substitution commands in the 
form: 's///'.\r\nTerminate the substitution list with an empty 
line.\r\n"
+regex_prompt = "Enter one or more sed substitution commands in the 
form: 's///'.\r\nTerminate the substitution list with an empty 
line.\r\n"
 regex_prompt1 = "\r\n"
 
 child = pexpect.spawn('%s %s' %


Index: source/Commands/CommandObjectCommands.cpp
===
--- source/Commands/CommandObjectCommands.cpp
+++ source/Commands/CommandObjectCommands.cpp
@@ -1009,9 +1009,12 @@
 
 protected:
   void IOHandlerActivated(IOHandler _handler) override {
+if (!io_handler.GetIsInteractive() && !io_handler.GetIsRealTerminal())
+  // Don't print instructions during batch execution, such as .lldbinit.
+  return;
 StreamFileSP output_sp(io_handler.GetOutputStreamFile());
 if (output_sp) {
-  output_sp->PutCString("Enter one of more sed substitution commands in "
+  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();
Index: packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py
===
--- packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py
+++ packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py
@@ -24,7 +24,7 @@
 """Test a simple scenario of 'command regex' invocation and subsequent use."""
 import pexpect
 prompt = "(lldb) "
-regex_prompt = "Enter one of more sed substitution commands in the form: 's///'.\r\nTerminate the substitution list with an empty line.\r\n"
+regex_prompt = "Enter one or more sed substitution commands in the form: 's///'.\r\nTerminate the substitution list with an empty line.\r\n"
 regex_prompt1 = "\r\n"
 
 child = pexpect.spawn('%s %s' %
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits