From 77787033b9cbecf9c444c26221374f96bd1fd521 Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Thu, 20 Jan 2011 02:03:18 +0000 Subject: Back up both the register AND the stop state when calling functions. Set the thread state to "bland" before calling functions so they don't inherit the pending signals and die. llvm-svn: 123869 --- lldb/source/Target/ThreadPlanCallFunction.cpp | 30 +++++++++++++++++---------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'lldb/source/Target/ThreadPlanCallFunction.cpp') diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp index 9619f56bb35..8c9b3afa0d3 100644 --- a/lldb/source/Target/ThreadPlanCallFunction.cpp +++ b/lldb/source/Target/ThreadPlanCallFunction.cpp @@ -59,6 +59,8 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread, if (!abi) return; + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); + SetBreakpoints(); lldb::addr_t spBelowRedZone = thread.GetRegisterContext()->GetSP() - abi->GetRedZoneSize(); @@ -76,9 +78,16 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread, m_start_addr = context.symbol->GetValue(); lldb::addr_t StartLoadAddr = m_start_addr.GetLoadAddress(&target); - if (!thread.SaveFrameZeroState(m_register_backup)) + // Checkpoint the thread state so we can restore it later. + if (!thread.CheckpointThreadState (m_stored_thread_state)) + { + if (log) + log->Printf ("Setting up ThreadPlanCallFunction, failed to checkpoint thread state."); return; - + } + // Now set the thread state to "no reason" so we don't run with whatever signal was outstanding... + thread.SetStopInfoToNothing(); + m_function_addr = function; lldb::addr_t FunctionLoadAddr = m_function_addr.GetLoadAddress(&target); @@ -91,8 +100,6 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread, cmd_arg)) return; - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); - if (log) { RegisterContext *reg_ctx = m_thread.GetRegisterContext().get(); @@ -115,24 +122,24 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread, ThreadPlanCallFunction::~ThreadPlanCallFunction () { - if (m_valid && !IsPlanComplete()) DoTakedown(); } void ThreadPlanCallFunction::DoTakedown () { - m_thread.RestoreSaveFrameZero(m_register_backup); - m_thread.ClearStackFrames(); - SetPlanComplete(); - ClearBreakpoints(); + if (m_valid && !IsPlanComplete()) + { + m_thread.RestoreThreadStateFromCheckpoint(m_stored_thread_state); + SetPlanComplete(); + ClearBreakpoints(); + } } void ThreadPlanCallFunction::WillPop () { - if (m_valid && !IsPlanComplete()) - DoTakedown(); + DoTakedown(); } void @@ -278,6 +285,7 @@ ThreadPlanCallFunction::DidPush () m_subplan_sp.reset(new ThreadPlanRunToAddress(m_thread, m_start_addr, m_stop_other_threads)); m_thread.QueueThreadPlan(m_subplan_sp, false); + m_subplan_sp->SetPrivate (true); #endif } -- cgit v1.2.3