Add EchoCommentCommands to CommandInterpreterRunOptions in addition to the existing...
authorStefan Granitz <stefan.graenitz@gmail.com>
Fri, 5 Oct 2018 16:49:47 +0000 (16:49 +0000)
committerStefan Granitz <stefan.graenitz@gmail.com>
Fri, 5 Oct 2018 16:49:47 +0000 (16:49 +0000)
commitc678ed774dfa9109ecb3395a52d58c2248b7de9d
treeeb698b34fe3739a7e117aedf779dd7a46921cec6
parent90947214f3244bc59fdb531e57b5048120ec9095
Add EchoCommentCommands to CommandInterpreterRunOptions in addition to the existing EchoCommands and expose both as interpreter settings.

Summary:
Add settings to control command echoing:
```
(lldb) settings set interpreter.echo-commands true
(lldb) settings set interpreter.echo-comment-commands true
```

Both settings default to true, which keeps LLDB's existing behavior in non-interactive mode (echo all command inputs to the output).

So far the only way to change this behavior was the `--source-quietly` flag, which disables all output including evaluation results.
Now `echo-commands` allows to turn off echoing for commands, while evaluation results are still printed. No effect if `--source-quietly` was present.
`echo-comment-commands` allows to turn off echoing for commands in case they are pure comment lines. No effect if `echo-commands` is false.

Note that the behavior does not change immediately! The new settings take effect only with the next command source.

LLDB lit test are the main motivation for this feature. So far incoming `#CHECK` line have always been echoed to the output and so they could never fail. Now we can disable it in lit-lldb-init.
Todos: Finish test for this feature. Add to lit-lldb-init. Check for failing lit tests.

Reviewers: aprantl, jasonmolenda, JDevlieghere

Subscribers: friss, lldb-commits

Differential Revision: https://reviews.llvm.org/D52788

llvm-svn: 343859
12 files changed:
lldb/include/lldb/API/SBCommandInterpreter.h
lldb/include/lldb/Interpreter/CommandInterpreter.h
lldb/lit/Settings/Inputs/EchoCommandsAll.out [new file with mode: 0644]
lldb/lit/Settings/Inputs/EchoCommandsNoComments.out [new file with mode: 0644]
lldb/lit/Settings/Inputs/EchoCommandsNone.out [new file with mode: 0644]
lldb/lit/Settings/Inputs/EchoCommandsQuiet.out [new file with mode: 0644]
lldb/lit/Settings/Inputs/EchoCommandsTest.in [new file with mode: 0644]
lldb/lit/Settings/TestEchoCommands.test [new file with mode: 0644]
lldb/lit/lit-lldb-init
lldb/source/API/SBCommandInterpreter.cpp
lldb/source/Commands/CommandObjectCommands.cpp
lldb/source/Interpreter/CommandInterpreter.cpp