diff options
author | Jim Ingham <jingham@apple.com> | 2012-05-11 18:43:38 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2012-05-11 18:43:38 +0000 |
commit | 923886ce2c7e4142e6335df3b236f58d13f9d967 (patch) | |
tree | 0632847ed82ee435a2052712710a2fa3bace960d | |
parent | 4ae4160974c7dbc082d9c81d0ddbd30996531318 (diff) | |
download | bcm5719-llvm-923886ce2c7e4142e6335df3b236f58d13f9d967.tar.gz bcm5719-llvm-923886ce2c7e4142e6335df3b236f58d13f9d967.zip |
Don't try to use "OkayToDiscard" to mean BOTH this plan is a user plan or not AND unwind on error.
rdar://problem/11419156
llvm-svn: 156627
7 files changed, 31 insertions, 18 deletions
diff --git a/lldb/include/lldb/Target/ThreadPlanCallFunction.h b/lldb/include/lldb/Target/ThreadPlanCallFunction.h index 4062256e4f1..e22b9cb4958 100644 --- a/lldb/include/lldb/Target/ThreadPlanCallFunction.h +++ b/lldb/include/lldb/Target/ThreadPlanCallFunction.h @@ -133,7 +133,6 @@ private: bool ConstructorSetup (Thread &thread, - bool discard_on_error, ABI *& abi, lldb::addr_t &start_load_addr, lldb::addr_t &function_load_addr); @@ -170,6 +169,7 @@ private: lldb::ValueObjectSP m_return_valobj_sp; // If this contains a valid pointer, use the ABI to extract values when complete bool m_takedown_done; // We want to ensure we only do the takedown once. This ensures that. lldb::addr_t m_stop_address; // This is the address we stopped at. Also set in DoTakedown; + bool m_discard_on_error; DISALLOW_COPY_AND_ASSIGN (ThreadPlanCallFunction); }; diff --git a/lldb/source/Expression/ClangFunction.cpp b/lldb/source/Expression/ClangFunction.cpp index a6344f925ee..d75f5eb32b9 100644 --- a/lldb/source/Expression/ClangFunction.cpp +++ b/lldb/source/Expression/ClangFunction.cpp @@ -410,6 +410,8 @@ ClangFunction::GetThreadPlanToCallFunction (ExecutionContext &exe_ctx, discard_on_error, this_arg, cmd_arg); + new_plan->SetIsMasterPlan(true); + new_plan->SetOkayToDiscard (false); return new_plan; } diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp index e561a9f9b7f..7ffac108ebe 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp @@ -65,12 +65,8 @@ AppleThreadPlanStepThroughObjCTrampoline::~AppleThreadPlanStepThroughObjCTrampol void AppleThreadPlanStepThroughObjCTrampoline::DidPush () { -// StreamString errors; -// ExecutionContext exc_ctx; -// m_thread.CalculateExecutionContext(exc_ctx); -// m_func_sp.reset(m_impl_function->GetThreadPlanToCallFunction (exc_ctx, m_args_addr, errors, m_stop_others)); -// m_func_sp->SetPrivate(true); -// m_thread.QueueThreadPlan (m_func_sp, false); + // Setting up the memory space for the called function text might require allocations, + // i.e. a nested function call. This needs to be done as a PreResumeAction. m_thread.GetProcess()->AddPreResumeAction (PreResumeInitializeClangFunction, (void *) this); } @@ -91,6 +87,7 @@ AppleThreadPlanStepThroughObjCTrampoline::InitializeClangFunction () m_thread.CalculateExecutionContext(exc_ctx); m_func_sp.reset(m_impl_function->GetThreadPlanToCallFunction (exc_ctx, m_args_addr, errors, m_stop_others)); m_func_sp->SetPrivate(true); + m_func_sp->SetOkayToDiscard(true); m_thread.QueueThreadPlan (m_func_sp, false); } return true; diff --git a/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp b/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp index 376c41bc002..a68f7d38def 100644 --- a/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp +++ b/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp @@ -90,6 +90,10 @@ bool lldb_private::InferiorCallMmap(Process *process, addr_t &allocated_addr, if (call_plan_sp) { StreamFile error_strm; + // This plan is a utility plan, so set it to discard itself when done. + call_plan_sp->SetIsMasterPlan (true); + call_plan_sp->SetOkayToDiscard(true); + StackFrame *frame = thread->GetStackFrameAtIndex (0).get(); if (frame) { @@ -164,6 +168,10 @@ bool lldb_private::InferiorCallMunmap(Process *process, addr_t addr, if (call_plan_sp) { StreamFile error_strm; + // This plan is a utility plan, so set it to discard itself when done. + call_plan_sp->SetIsMasterPlan (true); + call_plan_sp->SetOkayToDiscard(true); + StackFrame *frame = thread->GetStackFrameAtIndex (0).get(); if (frame) { diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index 03512139286..822015af75f 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -447,7 +447,6 @@ Thread::ShouldStop (Event* event_ptr) break; } } - } else { diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp index 7ebe879f904..8e91e8b35d6 100644 --- a/lldb/source/Target/ThreadPlanCallFunction.cpp +++ b/lldb/source/Target/ThreadPlanCallFunction.cpp @@ -36,15 +36,12 @@ using namespace lldb_private; //---------------------------------------------------------------------- bool ThreadPlanCallFunction::ConstructorSetup (Thread &thread, - bool discard_on_error, ABI *& abi, lldb::addr_t &start_load_addr, lldb::addr_t &function_load_addr) { - // Call function thread plans need to be master plans so that they can potentially stay on the stack when - // a breakpoint is hit during the function call. SetIsMasterPlan (true); - SetOkayToDiscard (discard_on_error); + SetOkayToDiscard (false); ProcessSP process_sp (thread.GetProcess()); if (!process_sp) @@ -136,12 +133,13 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread, m_function_sp (NULL), m_return_type (return_type), m_takedown_done (false), - m_stop_address (LLDB_INVALID_ADDRESS) + m_stop_address (LLDB_INVALID_ADDRESS), + m_discard_on_error (discard_on_error) { lldb::addr_t start_load_addr; ABI *abi; lldb::addr_t function_load_addr; - if (!ConstructorSetup (thread, discard_on_error, abi, start_load_addr, function_load_addr)) + if (!ConstructorSetup (thread, abi, start_load_addr, function_load_addr)) return; if (this_arg && cmd_arg) @@ -204,7 +202,7 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread, lldb::addr_t start_load_addr; ABI *abi; lldb::addr_t function_load_addr; - if (!ConstructorSetup (thread, discard_on_error, abi, start_load_addr, function_load_addr)) + if (!ConstructorSetup (thread, abi, start_load_addr, function_load_addr)) return; if (!abi->PrepareTrivialCall (thread, @@ -354,7 +352,7 @@ ThreadPlanCallFunction::PlanExplainsStop () return true; // If we don't want to discard this plan, than any stop we don't understand should be propagated up the stack. - if (!OkayToDiscard()) + if (!m_discard_on_error) return false; // Otherwise, check the case where we stopped for an internal breakpoint, in that case, continue on. @@ -386,7 +384,13 @@ ThreadPlanCallFunction::PlanExplainsStop () return false; } - return OkayToDiscard(); + if (m_discard_on_error) + { + DoTakedown(false); + return true; + } + else + return false; } else { @@ -396,7 +400,7 @@ ThreadPlanCallFunction::PlanExplainsStop () // explain the stop. if (m_subplan_sp != NULL) { - if (OkayToDiscard()) + if (m_discard_on_error) { DoTakedown(false); return true; diff --git a/lldb/source/Target/ThreadPlanCallUserExpression.cpp b/lldb/source/Target/ThreadPlanCallUserExpression.cpp index b46d6b4704d..f739d2aef2c 100644 --- a/lldb/source/Target/ThreadPlanCallUserExpression.cpp +++ b/lldb/source/Target/ThreadPlanCallUserExpression.cpp @@ -47,6 +47,9 @@ ThreadPlanCallUserExpression::ThreadPlanCallUserExpression (Thread &thread, ThreadPlanCallFunction (thread, function, ClangASTType(), arg, stop_other_threads, discard_on_error, this_arg, cmd_arg), m_user_expression_sp (user_expression_sp) { + // User expressions are generally "User generated" so we should set them up to stop when done. + SetIsMasterPlan (true); + SetOkayToDiscard(false); } ThreadPlanCallUserExpression::~ThreadPlanCallUserExpression () |