[Lldb-commits] [lldb] [lldb-dap] Fix global-scope evaluate always routing to command interpreter (PR #225243)
Nathan Fusselman via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 22 07:46:53 PDT 2026
================
@@ -225,14 +230,22 @@ def assert_eval_fails(expression: str):
session.verify_evaluate(eval_body, matches="20")
if context_parses_expressions:
- # Access global variable without a frame
- # Run in variable mode to avoid interpreting it as a command.
- session.evaluate("`lldb-dap repl-mode variable", context="repl")
-
+ # Access a global variable with no frame at all (frameId omitted).
eval_body = session.evaluate("static_int", context=context)
session.verify_evaluate(eval_body, matches="42", type="int")
- session.evaluate("`lldb-dap repl-mode auto", context="repl")
+ assert_eval_fails_frameless("var1") # local, not global.
+ assert_eval_fails_frameless("totally_bogus_expr_xyz")
+
+ if context in ("repl", None):
+ # `help` shares its name with a real lldb command (see main.cpp);
+ # it should resolve to the global, with an ambiguity warning.
+ eval_body = session.evaluate("help", context=context)
+ session.verify_evaluate(eval_body, matches="99", type="int")
+
+ # `version` has no matching global; still runs as a command frameless.
+ eval_body = session.evaluate("version", context=context)
+ session.verify_evaluate(eval_body, matches=r"^lldb[ -]\d", has_mem_ref=False)
----------------
nathanfusselman wrote:
Even better, I will just remove the usage of `version` here, it was a convenient one-word command but I can create a deterministic one that is not platform-dependent.
https://github.com/llvm/llvm-project/pull/225243
More information about the lldb-commits
mailing list