const EvaluateExpressionOptions &options);
~LLVMUserExpression() override;
- lldb::ExpressionResults
- Execute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
- const EvaluateExpressionOptions &options, lldb::UserExpressionSP &shared_ptr_to_me,
- lldb::ExpressionVariableSP &result) override;
-
bool
FinalizeJITExecution(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
lldb::ExpressionVariableSP &result,
lldb::ModuleSP GetJITModule() override;
protected:
+ lldb::ExpressionResults
+ DoExecute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
+ const EvaluateExpressionOptions &options, lldb::UserExpressionSP &shared_ptr_to_me,
+ lldb::ExpressionVariableSP &result) override;
+
virtual void
ScanContext(ExecutionContext &exe_ctx, lldb_private::Error &err) = 0;
MatchesContext (ExecutionContext &exe_ctx);
//------------------------------------------------------------------
- /// Execute the parsed expression
+ /// Execute the parsed expression by callinng the derived class's
+ /// DoExecute method.
///
/// @param[in] diagnostic_manager
/// A diagnostic manager to report errors to.
/// @return
/// A Process::Execution results value.
//------------------------------------------------------------------
- virtual lldb::ExpressionResults
+ lldb::ExpressionResults
Execute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options,
- lldb::UserExpressionSP &shared_ptr_to_me, lldb::ExpressionVariableSP &result) = 0;
+ lldb::UserExpressionSP &shared_ptr_to_me, lldb::ExpressionVariableSP &result);
//------------------------------------------------------------------
/// Apply the side effects of the function to program state.
}
protected:
+ virtual lldb::ExpressionResults
+ DoExecute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options,
+ lldb::UserExpressionSP &shared_ptr_to_me, lldb::ExpressionVariableSP &result) = 0;
+
static lldb::addr_t
GetObjectPointer (lldb::StackFrameSP frame_sp,
ConstString &object_name,
# The hit count for the breakpoint should be 1.
self.assertTrue(breakpoint.GetHitCount() == 1)
+ # Test that the condition expression didn't create a result variable:
+ options = lldb.SBExpressionOptions()
+ value = frame0.EvaluateExpression("$0", options)
+ self.assertTrue(value.GetError().Fail(), "Conditions should not make result variables.")
process.Continue()
options.SetUnwindOnError(true);
options.SetIgnoreBreakpoints(true);
options.SetTryAllThreads(true);
+ options.SetResultIsInternal(true); // Don't generate a user variable for condition expressions.
Error expr_error;
}
lldb::ExpressionResults
-LLVMUserExpression::Execute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
- const EvaluateExpressionOptions &options, lldb::UserExpressionSP &shared_ptr_to_me,
- lldb::ExpressionVariableSP &result)
+LLVMUserExpression::DoExecute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
+ const EvaluateExpressionOptions &options, lldb::UserExpressionSP &shared_ptr_to_me,
+ lldb::ExpressionVariableSP &result)
{
// The expression log is quite verbose, and if you're just tracking the execution of the
// expression, it's quite convenient to have these logs come out with the STEP log as well.
execution_results =
user_expression_sp->Execute(diagnostic_manager, exe_ctx, options, user_expression_sp, expr_result);
- if (options.GetResultIsInternal() && expr_result && process)
- {
- process->GetTarget().GetPersistentExpressionStateForLanguage(language)->RemovePersistentVariable (expr_result);
- }
-
if (execution_results != lldb::eExpressionCompleted)
{
if (log)
return execution_results;
}
+
+lldb::ExpressionResults
+UserExpression::Execute(DiagnosticManager &diagnostic_manager,
+ ExecutionContext &exe_ctx,
+ const EvaluateExpressionOptions &options,
+ lldb::UserExpressionSP &shared_ptr_to_me,
+ lldb::ExpressionVariableSP &result_var)
+{
+ lldb::ExpressionResults expr_result = DoExecute(diagnostic_manager, exe_ctx, options, shared_ptr_to_me, result_var);
+ Target *target = exe_ctx.GetTargetPtr();
+ if (options.GetResultIsInternal() && result_var && target)
+ {
+ target->GetPersistentExpressionStateForLanguage(m_language)->RemovePersistentVariable (result_var);
+ }
+ return expr_result;
+}
+
+
}
lldb::ExpressionResults
-GoUserExpression::Execute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
- const EvaluateExpressionOptions &options, lldb::UserExpressionSP &shared_ptr_to_me,
- lldb::ExpressionVariableSP &result)
+GoUserExpression::DoExecute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
+ const EvaluateExpressionOptions &options, lldb::UserExpressionSP &shared_ptr_to_me,
+ lldb::ExpressionVariableSP &result)
{
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS | LIBLLDB_LOG_STEP));
lldb_private::ExecutionPolicy execution_policy, bool keep_result_in_memory,
bool generate_debug_info) override;
- lldb::ExpressionResults
- Execute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
- const EvaluateExpressionOptions &options, lldb::UserExpressionSP &shared_ptr_to_me,
- lldb::ExpressionVariableSP &result) override;
-
bool
CanInterpret() override
{
return true;
}
+ protected:
+ lldb::ExpressionResults
+ DoExecute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
+ const EvaluateExpressionOptions &options, lldb::UserExpressionSP &shared_ptr_to_me,
+ lldb::ExpressionVariableSP &result) override;
+
private:
class GoInterpreter;
std::unique_ptr<GoInterpreter> m_interpreter;