[Lldb-commits] [PATCH] D144114: [lldb] Add expression command options in dwim-print

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 16 09:45:07 PST 2023


kastiglione added inline comments.


================
Comment at: lldb/source/Commands/CommandObjectDWIMPrint.cpp:68
   // First, try `expr` as the name of a frame variable.
-  if (StackFrame *frame = m_exe_ctx.GetFramePtr()) {
-    auto valobj_sp = frame->FindVariable(ConstString(expr));
-    if (valobj_sp && valobj_sp->GetError().Success()) {
-      if (verbosity == eDWIMPrintVerbosityFull) {
-        StringRef flags;
-        if (args.HasArgs())
-          flags = args.GetArgString();
-        result.AppendMessageWithFormatv("note: ran `frame variable {0}{1}`",
-                                        flags, expr);
+  bool force_expression = m_expr_options.debug || m_expr_options.top_level;
+  if (!force_expression) {
----------------
aprantl wrote:
> Maybe comment here that these are the only options that only make sense in the expression evaluator?
As we discussed offline, instead of having flags that force expression evaluation, those flags are no longer exposed. If users need to force expression evaluation, they can use the `expression` command directly.


================
Comment at: lldb/test/API/commands/dwim-print/TestDWIMPrint.py:119
+        self._expect_cmd(f"dwim-print --debug -- argc", "expression")
+        with self.assertRaises(AssertionError):
+            # At the top-level, `argc` is not visible.
----------------
aprantl wrote:
> why is this needed?
the test this comment referred to has since been deleted, on account of no longer having flags that force expression evaluation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144114



More information about the lldb-commits mailing list