[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:54 PDT 2026


================
@@ -618,7 +614,12 @@ ReplMode DAP::DetectReplMode(lldb::SBFrame &frame, std::string &expression,
   const bool is_command = interpreter.CommandExists(first_cstr) ||
                           interpreter.UserCommandExists(first_cstr) ||
                           interpreter.AliasExists(first_cstr);
-  const bool is_variable = frame.FindVariable(first_cstr).IsValid();
+  // Without a frame there are no locals to check; fall back to `target`
+  // (this DAP's own member, valid independent of `frame`) to look up a
+  // global/static of the same name instead.
+  const bool is_variable =
+      frame ? frame.FindVariable(first_cstr).IsValid()
+            : target.FindFirstGlobalVariable(first_cstr).IsValid();
----------------
nathanfusselman wrote:

Great point, I was thinking too narrowly at the exact problem I was trying to solve. Adding a test for that too.

https://github.com/llvm/llvm-project/pull/225243


More information about the lldb-commits mailing list