diff options
author | Jim Ingham <jingham@apple.com> | 2013-01-15 02:47:48 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2013-01-15 02:47:48 +0000 |
commit | 184e981111d74fe650b7ea4506adc9bc356273ee (patch) | |
tree | 63abd3ef966759715411399c4d4be97325611df5 /lldb/source/Expression | |
parent | ed1950719b38c2dde6d3c1efe1f216a7d90a04b4 (diff) | |
download | bcm5719-llvm-184e981111d74fe650b7ea4506adc9bc356273ee.tar.gz bcm5719-llvm-184e981111d74fe650b7ea4506adc9bc356273ee.zip |
Separated the "expr --unwind-on-error" behavior into two parts, actual errors (i.e. crashes) which continue to be
controlled by the --unwind-on-error flag, and --ignore-breakpoint which separately controls behavior when a called
function hits a breakpoint. For breakpoints, we don't unwind, we either stop, or ignore the breakpoint, which makes
more sense.
Also make both these behaviors globally settable through "settings set".
Also handle the case where a breakpoint command calls code that ends up re-hitting the breakpoint. We were recursing
and crashing. Now we just stop without calling the second command.
<rdar://problem/12986644>
<rdar://problem/9119325>
llvm-svn: 172503
Diffstat (limited to 'lldb/source/Expression')
-rw-r--r-- | lldb/source/Expression/ClangFunction.cpp | 32 | ||||
-rw-r--r-- | lldb/source/Expression/ClangUserExpression.cpp | 34 |
2 files changed, 44 insertions, 22 deletions
diff --git a/lldb/source/Expression/ClangFunction.cpp b/lldb/source/Expression/ClangFunction.cpp index 49e09c4e7d2..2d69941a010 100644 --- a/lldb/source/Expression/ClangFunction.cpp +++ b/lldb/source/Expression/ClangFunction.cpp @@ -402,7 +402,8 @@ ClangFunction::GetThreadPlanToCallFunction (ExecutionContext &exe_ctx, lldb::addr_t &args_addr, Stream &errors, bool stop_others, - bool discard_on_error, + bool unwind_on_error, + bool ignore_breakpoints, lldb::addr_t *this_arg, lldb::addr_t *cmd_arg) { @@ -422,7 +423,8 @@ ClangFunction::GetThreadPlanToCallFunction (ExecutionContext &exe_ctx, ClangASTType(), args_addr, stop_others, - discard_on_error, + unwind_on_error, + ignore_breakpoints, this_arg, cmd_arg); new_plan->SetIsMasterPlan(true); @@ -479,8 +481,10 @@ ExecutionResults ClangFunction::ExecuteFunction(ExecutionContext &exe_ctx, Stream &errors, bool stop_others, Value &results) { const bool try_all_threads = false; - const bool discard_on_error = true; - return ExecuteFunction (exe_ctx, NULL, errors, stop_others, 0UL, try_all_threads, discard_on_error, results); + const bool unwind_on_error = true; + const bool ignore_breakpoints = true; + return ExecuteFunction (exe_ctx, NULL, errors, stop_others, 0UL, try_all_threads, + unwind_on_error, ignore_breakpoints, results); } ExecutionResults @@ -492,9 +496,10 @@ ClangFunction::ExecuteFunction( Value &results) { const bool stop_others = true; - const bool discard_on_error = true; + const bool unwind_on_error = true; + const bool ignore_breakpoints = true; return ExecuteFunction (exe_ctx, NULL, errors, stop_others, timeout_usec, - try_all_threads, discard_on_error, results); + try_all_threads, unwind_on_error, ignore_breakpoints, results); } // This is the static function @@ -505,7 +510,8 @@ ClangFunction::ExecuteFunction ( lldb::addr_t &void_arg, bool stop_others, bool try_all_threads, - bool discard_on_error, + bool unwind_on_error, + bool ignore_breakpoints, uint32_t timeout_usec, Stream &errors, lldb::addr_t *this_arg) @@ -515,7 +521,8 @@ ClangFunction::ExecuteFunction ( void_arg, errors, stop_others, - discard_on_error, + unwind_on_error, + ignore_breakpoints, this_arg)); if (!call_plan_sp) return eExecutionSetupError; @@ -528,7 +535,8 @@ ClangFunction::ExecuteFunction ( ExecutionResults results = exe_ctx.GetProcessRef().RunThreadPlan (exe_ctx, call_plan_sp, stop_others, try_all_threads, - discard_on_error, + unwind_on_error, + ignore_breakpoints, timeout_usec, errors); @@ -546,7 +554,8 @@ ClangFunction::ExecuteFunction( bool stop_others, uint32_t timeout_usec, bool try_all_threads, - bool discard_on_error, + bool unwind_on_error, + bool ignore_breakpoints, Value &results) { using namespace clang; @@ -573,7 +582,8 @@ ClangFunction::ExecuteFunction( args_addr, stop_others, try_all_threads, - discard_on_error, + unwind_on_error, + ignore_breakpoints, timeout_usec, errors); diff --git a/lldb/source/Expression/ClangUserExpression.cpp b/lldb/source/Expression/ClangUserExpression.cpp index 81db3288277..d228569fa1c 100644 --- a/lldb/source/Expression/ClangUserExpression.cpp +++ b/lldb/source/Expression/ClangUserExpression.cpp @@ -537,12 +537,16 @@ ClangUserExpression::GetThreadPlanToExecuteJITExpression (Stream &error_stream, // ClangUserExpression resources before the thread plan finishes execution in the target. But because we are // forcing unwind_on_error to be true here, in practical terms that can't happen. + const bool stop_others = true; + const bool unwind_on_error = true; + const bool ignore_breakpoints = false; return ClangFunction::GetThreadPlanToCallFunction (exe_ctx, m_jit_start_addr, struct_address, error_stream, - true, - true, + stop_others, + unwind_on_error, + ignore_breakpoints, (m_needs_object_ptr ? &object_ptr : NULL), (m_needs_object_ptr && m_objectivec) ? &cmd_ptr : NULL); } @@ -593,7 +597,8 @@ ClangUserExpression::FinalizeJITExecution (Stream &error_stream, ExecutionResults ClangUserExpression::Execute (Stream &error_stream, ExecutionContext &exe_ctx, - bool discard_on_error, + bool unwind_on_error, + bool ignore_breakpoints, ClangUserExpression::ClangUserExpressionSP &shared_ptr_to_me, lldb::ClangExpressionVariableSP &result, bool run_others, @@ -624,7 +629,8 @@ ClangUserExpression::Execute (Stream &error_stream, wrapper_address, struct_address, stop_others, - discard_on_error, + unwind_on_error, + ignore_breakpoints, (m_needs_object_ptr ? &object_ptr : NULL), ((m_needs_object_ptr && m_objectivec) ? &cmd_ptr : NULL), shared_ptr_to_me)); @@ -644,7 +650,8 @@ ClangUserExpression::Execute (Stream &error_stream, call_plan_sp, stop_others, try_all_threads, - discard_on_error, + unwind_on_error, + ignore_breakpoints, timeout_usec, error_stream); @@ -654,7 +661,7 @@ ClangUserExpression::Execute (Stream &error_stream, if (log) log->Printf("-- [ClangUserExpression::Execute] Execution of expression completed --"); - if (execution_result == eExecutionInterrupted) + if (execution_result == eExecutionInterrupted || execution_result == eExecutionHitBreakpoint) { const char *error_desc = NULL; @@ -669,7 +676,8 @@ ClangUserExpression::Execute (Stream &error_stream, else error_stream.Printf ("Execution was interrupted."); - if (discard_on_error) + if ((execution_result == eExecutionInterrupted && unwind_on_error) + || (execution_result == eExecutionHitBreakpoint && ignore_breakpoints)) error_stream.Printf ("\nThe process has been returned to the state before execution."); else error_stream.Printf ("\nThe process has been left at the point where it was interrupted."); @@ -702,7 +710,8 @@ ClangUserExpression::Evaluate (ExecutionContext &exe_ctx, lldb_private::ExecutionPolicy execution_policy, lldb::LanguageType language, ResultType desired_type, - bool discard_on_error, + bool unwind_on_error, + bool ignore_breakpoints, const char *expr_cstr, const char *expr_prefix, lldb::ValueObjectSP &result_valobj_sp, @@ -714,7 +723,8 @@ ClangUserExpression::Evaluate (ExecutionContext &exe_ctx, execution_policy, language, desired_type, - discard_on_error, + unwind_on_error, + ignore_breakpoints, expr_cstr, expr_prefix, result_valobj_sp, @@ -728,7 +738,8 @@ ClangUserExpression::EvaluateWithError (ExecutionContext &exe_ctx, lldb_private::ExecutionPolicy execution_policy, lldb::LanguageType language, ResultType desired_type, - bool discard_on_error, + bool unwind_on_error, + bool ignore_breakpoints, const char *expr_cstr, const char *expr_prefix, lldb::ValueObjectSP &result_valobj_sp, @@ -807,7 +818,8 @@ ClangUserExpression::EvaluateWithError (ExecutionContext &exe_ctx, execution_results = user_expression_sp->Execute (error_stream, exe_ctx, - discard_on_error, + unwind_on_error, + ignore_breakpoints, user_expression_sp, expr_result, run_others, |