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

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 15 16:00:48 PST 2023


aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.

Conceptually, I think this looks good to me.



================
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) {
----------------
Maybe comment here that these are the only options that only make sense in the expression evaluator?


================
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.
----------------
why is this needed?


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