[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
Sun Sep 8 23:54:16 PDT 2024
================
@@ -1363,6 +1363,14 @@ void request_evaluate(const llvm::json::Object &request) {
lldb::SBFrame frame = g_dap.GetLLDBFrame(*arguments);
std::string expression = GetString(arguments, "expression").str();
llvm::StringRef context = GetString(arguments, "context");
+ static std::string last_nonempty_expression;
+
+ // Remember the last non-empty expression from the user, and use that if
+ // the current expression is empty (i.e. the user hit plain 'return').
+ if (!expression.empty())
+ last_nonempty_expression = expression;
+ else
+ expression = last_nonempty_expression;
if (context == "repl" && g_dap.DetectExpressionContext(frame, expression) ==
----------------
labath wrote:
We probably ought to be doing this only for commands in the "repl" context. I don't think want to repeat random expressions automatically evaluated by the IDE (e.g. to fill the "watch" window).
https://github.com/llvm/llvm-project/pull/107485
More information about the lldb-commits
mailing list