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

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 16 04:18:39 PDT 2024


================
@@ -1364,8 +1364,14 @@ void request_evaluate(const llvm::json::Object &request) {
   std::string expression = GetString(arguments, "expression").str();
   llvm::StringRef context = GetString(arguments, "context");
 
-  if (context == "repl" && g_dap.DetectExpressionContext(frame, expression) ==
-                               ExpressionContext::Command) {
+  if (context == "repl" &&
+      (expression.empty() ?
+       g_dap.last_nonempty_var_expression.empty() :
+       g_dap.DetectExpressionContext(frame, expression) ==
----------------
labath wrote:

.. but note that the work that DetectExpressionContext does (looking up local variables) is relatively expensive, so we probably don't want to do it when it's not needed (when `context!="repl"`). 

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


More information about the lldb-commits mailing list