diff --git a/lldb/include/lldb/Expression/REPL.h b/lldb/include/lldb/Expression/REPL.h --- a/lldb/include/lldb/Expression/REPL.h +++ b/lldb/include/lldb/Expression/REPL.h @@ -107,6 +107,18 @@ CompletionRequest &request) override; protected: + /// Method that can be optionally overriden by subclasses to get notified + /// whenever an expression has been evaluated. The params of this method + /// include the inputs and outputs of the expression evaluation. + /// + /// Note: meta commands that start with : are not included by this method. + virtual void + OnExpressionEvaluated(const ExecutionContext &exe_ctx, llvm::StringRef code, + const EvaluateExpressionOptions &expr_options, + lldb::ExpressionResults execution_results, + const lldb::ValueObjectSP &result_valobj_sp, + const Status &error) {} + static int CalculateActualIndentation(const StringList &lines); // Subclasses should override these functions to implement a functional REPL. diff --git a/lldb/source/Expression/REPL.cpp b/lldb/source/Expression/REPL.cpp --- a/lldb/source/Expression/REPL.cpp +++ b/lldb/source/Expression/REPL.cpp @@ -342,7 +342,8 @@ expr_prefix, result_valobj_sp, error, nullptr); // fixed expression - // CommandInterpreter &ci = debugger.GetCommandInterpreter(); + OnExpressionEvaluated(exe_ctx, code, expr_options, execution_results, + result_valobj_sp, error); if (process_sp && process_sp->IsAlive()) { bool add_to_code = true;