================
@@ -23,24 +24,66 @@ using namespace lldb_dap::protocol;
namespace lldb_dap {
+static bool RunExpressionAsLLDBCommand(DAP &dap, lldb::SBFrame &frame,
+ std::string &expression,
+ EvaluateContext context) {
+ if (context != eEvaluateContextRepl && context != eEvaluateContextUnknown)
+ return false;
+
+ // Since we don't know this context do not try to repeat the last command;
+ if (context == eEvaluateContextUnknown && expression.empty())
+ return false;
+
+ const bool repeat_last_command =
+ expression.empty() && dap.last_valid_variable_expression.empty();
+ if (repeat_last_command)
+ return true;
+
+ const ReplMode repl_mode = dap.DetectReplMode(frame, expression, false);
+ return repl_mode == ReplMode::Command;
+}
+
+static lldb::SBValue EvaluateVariableExpression(lldb::SBTarget &target,
+ lldb::SBFrame &frame,
+ llvm::StringRef expression,
+ bool run_as_expression) {
+ const char *expression_cstr = expression.data();
----------------
DrSergei wrote:
can we take `expression` as `const std::string &` to ensure that it's a valid
cstring (null terminated).
https://github.com/llvm/llvm-project/pull/179667
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits