Skip to content

Commit cc8e6ec

Browse files
lawrence-danna-appleJDevlieghere
authored andcommitted
[lldb] fix --source-quietly
Jim says: lldb has a -Q or --source-quietly option, which supposedly does: --source-quietly Tells the debugger to execute this one-line lldb command before any file has been loaded. That seems like a weird description, since we don't generally use source for one line entries, but anyway, let's try it: > $LLDB_LLVM/clean-mono/build/Debug/bin/lldb -Q "script print('I should be quiet')" a.out -O "script print('I should be before')" -o "script print('I should be after')" (lldb) script print('I should be before') I should be before (lldb) target create "script print('I should be quiet')" error: unable to find executable for 'script print('I should be quiet')' That was weird. The first real -O gets sourced but not quietly, then the argument to the -Q gets treated as the target. > $LLDB_LLVM/clean-mono/build/Debug/bin/lldb -Q a.out -O "script print('I should be before')" -o "script print('I should be after')" (lldb) script print('I should be before') I should be before (lldb) target create "a.out" Current executable set to '/tmp/a.out' (x86_64). (lldb) script print('I should be after') I should be after Well, that's a little better, but the -Q option seems to have done nothing. --- This fixes the description of --source-quietly, as well as causing it to actually suppress echoing while executing the initialization commands. Reviewed By: jingham Differential Revision: https://reviews.llvm.org/D112988 (cherry picked from commit e2a6c08)
1 parent 74fd303 commit cc8e6ec

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

lldb/docs/man/lldb.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ COMMANDS
112112

113113
.. option:: --source-quietly
114114

115-
Tells the debugger to execute this one-line lldb command before any file has been loaded.
115+
Tells the debugger not to echo commands while sourcing files or one-line commands provided on the command line.
116116

117117
.. option:: --source <file>
118118

lldb/test/Shell/Driver/TestQuiet.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
RUN: %lldb -b -Q -o "expr 40 + 2" | FileCheck %s
2+
RUN: %lldb -b -Q -O "expr 40 + 2" | FileCheck %s
3+
4+
CHECK-NOT: expr
5+
CHECK-NOT: lldb
6+
CHECK-NOT: source
7+
CHECK: 42

lldb/tools/driver/Driver.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ int Driver::MainLoop() {
618618
options.SetSpawnThread(false);
619619
options.SetStopOnError(true);
620620
options.SetStopOnCrash(m_option_data.m_batch);
621+
options.SetEchoCommands(!m_option_data.m_source_quietly);
621622

622623
SBCommandInterpreterRunResult results =
623624
m_debugger.RunCommandInterpreter(options);

lldb/tools/driver/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def: Flag<["-"], "b">,
110110
Group<grp_command>;
111111

112112
def source_quietly: F<"source-quietly">,
113-
HelpText<"Tells the debugger to execute this one-line lldb command before any file has been loaded.">,
113+
HelpText<"Tells the debugger not to echo commands while sourcing files or one-line commands provided on the command line.">,
114114
Group<grp_command>;
115115
def: Flag<["-"], "Q">,
116116
Alias<source_quietly>,

0 commit comments

Comments
 (0)