[Lldb-commits] [lldb] [lldb-dap] Add feature to remember last non-empty expression. (PR #107485)

Walter Erquinigo via lldb-commits lldb-commits at lists.llvm.org
Sat Sep 14 10:25:18 PDT 2024


================
@@ -1376,6 +1382,16 @@ void request_evaluate(const llvm::json::Object &request) {
     EmplaceSafeString(body, "result", result);
     body.try_emplace("variablesReference", (int64_t)0);
   } else {
+    if (context == "repl") {
+      // If the expression is empty and the last expression was for a
+      // variable, set the expression to the previous expression (repeat the
+      // evaluation); otherwise save the current non-empty expression for the
+      // next (possibly empty) variable expression.
+      if (expression.empty())
+        expression = g_dap.last_nonempty_var_expression;
----------------
walter-erquinigo wrote:

IIUC, this has the following flow in the debug console:

- You send a command (non-var expression) FOO
- You send a var expression VAR
- You send empty text -> then FOO repeats

If that understanding is correct, that would lead to a confusing behavior. I think it's better to repeat only if the previous input was exactly a command.

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


More information about the lldb-commits mailing list