llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-lldb Author: Will Hawkins (hawkinsw) <details> <summary>Changes</summary> When DWIM printing, lldb will usually output explanatory feedback about the actual command used to generate the printed output (when the user has set the DWIM print verbosity to `true`). However, when DWIM printing a persistent variable, that note was omitted. This patch adds the explanatory message in that case. --- Full diff: https://github.com/llvm/llvm-project/pull/215650.diff 2 Files Affected: - (modified) lldb/source/Commands/CommandObjectDWIMPrint.cpp (+9) - (modified) lldb/test/Shell/Commands/command-dwim-print.test (+8) ``````````diff diff --git a/lldb/source/Commands/CommandObjectDWIMPrint.cpp b/lldb/source/Commands/CommandObjectDWIMPrint.cpp index 1b0b4c7881cfc..5a9524e7d2e02 100644 --- a/lldb/source/Commands/CommandObjectDWIMPrint.cpp +++ b/lldb/source/Commands/CommandObjectDWIMPrint.cpp @@ -197,6 +197,15 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command, language.AsLanguageType())) if (auto var_sp = state->GetVariable(expr)) if (auto valobj_sp = var_sp->GetValueObject()) { + + if (verbosity == eDWIMPrintVerbosityFull) { + StringRef flags; + if (args.HasArgs()) + flags = args.GetArgStringWithDelimiter(); + result.AppendNoteWithFormatv("ran `expression {0}{1}`", flags, + expr); + } + dump_val_object(*valobj_sp); return; } diff --git a/lldb/test/Shell/Commands/command-dwim-print.test b/lldb/test/Shell/Commands/command-dwim-print.test index 8c2697d8ebf8c..21c0cb440d958 100644 --- a/lldb/test/Shell/Commands/command-dwim-print.test +++ b/lldb/test/Shell/Commands/command-dwim-print.test @@ -14,3 +14,11 @@ # RUN: echo quit | %lldb -o "settings set show-inline-diagnostics false" \ # RUN: -o "dwim-print a" 2>&1 | FileCheck %s --check-prefix=CHECK4 # CHECK4: error: <user expression 0>:1:1: use of undeclared identifier +# RUN: echo "int main(){int x = 1; return 0;}">%t.c +# RUN: %clang_host %t.c -g -O0 -o %t.exe +# RUN: echo quit | %lldb %t.exe -o "b main" -o "run" -o \ +# RUN: "dwim-print --persistent-result true -- x" -o \ +# RUN: "settings set dwim-print-verbosity full" -o \ +# RUN: "dwim-print -l C11 -- $0" 2>&1 | FileCheck %s --check-prefix=CHECK5 +# (lldb) dwim-print $0 +# CHECK5:note: ran `expression -l C11 -- $0` `````````` </details> https://github.com/llvm/llvm-project/pull/215650 _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
