diff options
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Expression/ClangUserExpression.cpp')
-rw-r--r-- | contrib/llvm/tools/lldb/source/Expression/ClangUserExpression.cpp | 96 |
1 files changed, 36 insertions, 60 deletions
diff --git a/contrib/llvm/tools/lldb/source/Expression/ClangUserExpression.cpp b/contrib/llvm/tools/lldb/source/Expression/ClangUserExpression.cpp index 7f09f6f..e4f2830 100644 --- a/contrib/llvm/tools/lldb/source/Expression/ClangUserExpression.cpp +++ b/contrib/llvm/tools/lldb/source/Expression/ClangUserExpression.cpp @@ -95,15 +95,9 @@ ClangUserExpression::~ClangUserExpression () clang::ASTConsumer * ClangUserExpression::ASTTransformer (clang::ASTConsumer *passthrough) -{ - ClangASTContext *clang_ast_context = m_target->GetScratchClangASTContext(); - - if (!clang_ast_context) - return NULL; - - if (!m_result_synthesizer.get()) - m_result_synthesizer.reset(new ASTResultSynthesizer(passthrough, - *m_target)); +{ + m_result_synthesizer.reset(new ASTResultSynthesizer(passthrough, + *m_target)); return m_result_synthesizer.get(); } @@ -508,6 +502,9 @@ ClangUserExpression::Parse (Stream &error_stream, if (!m_expr_decl_map->WillParse(exe_ctx, m_materializer_ap.get())) { error_stream.PutCString ("error: current process state is unsuitable for expression parsing\n"); + + m_expr_decl_map.reset(); // We are being careful here in the case of breakpoint conditions. + return false; } @@ -525,7 +522,7 @@ ClangUserExpression::Parse (Stream &error_stream, { error_stream.Printf ("error: %d errors parsing expression\n", num_errors); - m_expr_decl_map->DidParse(); + m_expr_decl_map.reset(); // We are being careful here in the case of breakpoint conditions. return false; } @@ -540,6 +537,8 @@ ClangUserExpression::Parse (Stream &error_stream, exe_ctx, m_can_interpret, execution_policy); + + m_expr_decl_map.reset(); // Make this go away since we don't need any of its state after parsing. This also gets rid of any ClangASTImporter::Minions. if (jit_error.Success()) { @@ -785,12 +784,9 @@ ClangUserExpression::FinalizeJITExecution (Stream &error_stream, ExecutionResults ClangUserExpression::Execute (Stream &error_stream, ExecutionContext &exe_ctx, - bool unwind_on_error, - bool ignore_breakpoints, + const EvaluateExpressionOptions& options, ClangUserExpression::ClangUserExpressionSP &shared_ptr_to_me, - lldb::ClangExpressionVariableSP &result, - bool run_others, - uint32_t timeout_usec) + lldb::ClangExpressionVariableSP &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. @@ -856,9 +852,18 @@ ClangUserExpression::Execute (Stream &error_stream, } else { + const uint32_t timeout_usec = options.GetTimeoutUsec(); + const bool debug = options.GetDebug(); + const bool unwind_on_error = debug ? false : options.DoesUnwindOnError(); + const bool ignore_breakpoints = debug ? false : options.DoesIgnoreBreakpoints(); const bool stop_others = true; - const bool try_all_threads = run_others; - + const bool try_all_threads = options.GetRunOthers(); + lldb::BreakpointSP debug_bkpt_sp; + if (debug) + { + // TODO: push this down into the thread plan and let the plan manage it + debug_bkpt_sp = exe_ctx.GetTargetRef().CreateBreakpoint(m_jit_start_addr, false, false); + } Address wrapper_address (m_jit_start_addr); lldb::ThreadPlanSP call_plan_sp(new ThreadPlanCallUserExpression (exe_ctx.GetThreadRef(), wrapper_address, @@ -893,6 +898,11 @@ ClangUserExpression::Execute (Stream &error_stream, timeout_usec, error_stream); + if (debug_bkpt_sp) + { + exe_ctx.GetTargetRef().RemoveBreakpointByID(debug_bkpt_sp->GetID()); + } + if (exe_ctx.GetProcessPtr()) exe_ctx.GetProcessPtr()->SetRunningUserExpression(false); @@ -947,48 +957,17 @@ ClangUserExpression::Execute (Stream &error_stream, ExecutionResults ClangUserExpression::Evaluate (ExecutionContext &exe_ctx, - lldb_private::ExecutionPolicy execution_policy, - lldb::LanguageType language, - ResultType desired_type, - bool unwind_on_error, - bool ignore_breakpoints, + const EvaluateExpressionOptions& options, const char *expr_cstr, const char *expr_prefix, lldb::ValueObjectSP &result_valobj_sp, - bool run_others, - uint32_t timeout_usec) -{ - Error error; - return EvaluateWithError (exe_ctx, - execution_policy, - language, - desired_type, - unwind_on_error, - ignore_breakpoints, - expr_cstr, - expr_prefix, - result_valobj_sp, - error, - run_others, - timeout_usec); -} - -ExecutionResults -ClangUserExpression::EvaluateWithError (ExecutionContext &exe_ctx, - lldb_private::ExecutionPolicy execution_policy, - lldb::LanguageType language, - ResultType desired_type, - bool unwind_on_error, - bool ignore_breakpoints, - const char *expr_cstr, - const char *expr_prefix, - lldb::ValueObjectSP &result_valobj_sp, - Error &error, - bool run_others, - uint32_t timeout_usec) + Error &error) { Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EXPRESSIONS | LIBLLDB_LOG_STEP)); + lldb_private::ExecutionPolicy execution_policy = options.GetExecutionPolicy(); + const lldb::LanguageType language = options.GetLanguage(); + const ResultType desired_type = options.DoesCoerceToId() ? ClangUserExpression::eResultTypeId : ClangUserExpression::eResultTypeAny; ExecutionResults execution_results = eExecutionSetupError; Process *process = exe_ctx.GetProcessPtr(); @@ -1046,13 +1025,10 @@ ClangUserExpression::EvaluateWithError (ExecutionContext &exe_ctx, log->Printf("== [ClangUserExpression::Evaluate] Executing expression =="); execution_results = user_expression_sp->Execute (error_stream, - exe_ctx, - unwind_on_error, - ignore_breakpoints, - user_expression_sp, - expr_result, - run_others, - timeout_usec); + exe_ctx, + options, + user_expression_sp, + expr_result); if (execution_results != eExecutionCompleted) { |