summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/ThreadPlanCallFunction.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2011-01-20 02:03:18 +0000
committerJim Ingham <jingham@apple.com>2011-01-20 02:03:18 +0000
commit77787033b9cbecf9c444c26221374f96bd1fd521 (patch)
tree9f16a835550cce58f68d5bc4afab59c3a4472423 /lldb/source/Target/ThreadPlanCallFunction.cpp
parent7d381c48fec57b35c3ce2e400ce53f68c456eabd (diff)
downloadbcm5719-llvm-77787033b9cbecf9c444c26221374f96bd1fd521.tar.gz
bcm5719-llvm-77787033b9cbecf9c444c26221374f96bd1fd521.zip
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
Diffstat (limited to 'lldb/source/Target/ThreadPlanCallFunction.cpp')
-rw-r--r--lldb/source/Target/ThreadPlanCallFunction.cpp30
1 files changed, 19 insertions, 11 deletions
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
}
OpenPOWER on IntegriCloud