diff options
| author | Jim Ingham <jingham@apple.com> | 2013-07-25 00:59:01 +0000 |
|---|---|---|
| committer | Jim Ingham <jingham@apple.com> | 2013-07-25 00:59:01 +0000 |
| commit | 886a3e2cdf9d2da450007f0794c98bc3f1ebb5d0 (patch) | |
| tree | e60f6a9c09a10d52560a2bbd8ccd03217479cf10 /lldb/source/Target/ThreadPlanStepInstruction.cpp | |
| parent | 440e9d81bf02746146c3fc817d87c3b8ef1416b2 (diff) | |
| download | bcm5719-llvm-886a3e2cdf9d2da450007f0794c98bc3f1ebb5d0.tar.gz bcm5719-llvm-886a3e2cdf9d2da450007f0794c98bc3f1ebb5d0.zip | |
Handle the case where we are stepping through code with no symbols, so we can't really find the function start PC
and so the StackID changes with every step. Do so by checking the parent frame ID, and if it hasn't changed,
then we haven't stepped in.
rdar://problem/14516227
llvm-svn: 187094
Diffstat (limited to 'lldb/source/Target/ThreadPlanStepInstruction.cpp')
| -rw-r--r-- | lldb/source/Target/ThreadPlanStepInstruction.cpp | 58 |
1 files changed, 37 insertions, 21 deletions
diff --git a/lldb/source/Target/ThreadPlanStepInstruction.cpp b/lldb/source/Target/ThreadPlanStepInstruction.cpp index f7a962ee19d..b07b374e38a 100644 --- a/lldb/source/Target/ThreadPlanStepInstruction.cpp +++ b/lldb/source/Target/ThreadPlanStepInstruction.cpp @@ -45,6 +45,9 @@ ThreadPlanStepInstruction::ThreadPlanStepInstruction { m_instruction_addr = m_thread.GetRegisterContext()->GetPC(0); m_stack_id = m_thread.GetStackFrameAtIndex(0)->GetStackID(); + StackFrameSP parent_frame_sp = m_thread.GetStackFrameAtIndex(1); + if (parent_frame_sp) + m_parent_frame_id = parent_frame_sp->GetStackID(); } ThreadPlanStepInstruction::~ThreadPlanStepInstruction () @@ -120,29 +123,42 @@ ThreadPlanStepInstruction::ShouldStop (Event *event_ptr) StackFrame *return_frame = m_thread.GetStackFrameAtIndex(1).get(); if (return_frame) { - if (log) + if (return_frame->GetStackID() != m_parent_frame_id) { - StreamString s; - s.PutCString ("Stepped in to: "); - addr_t stop_addr = m_thread.GetStackFrameAtIndex(0)->GetRegisterContext()->GetPC(); - s.Address (stop_addr, m_thread.CalculateTarget()->GetArchitecture().GetAddressByteSize()); - s.PutCString (" stepping out to: "); - addr_t return_addr = return_frame->GetRegisterContext()->GetPC(); - s.Address (return_addr, m_thread.CalculateTarget()->GetArchitecture().GetAddressByteSize()); - log->Printf("%s.", s.GetData()); + if (log) + { + StreamString s; + s.PutCString ("Stepped in to: "); + addr_t stop_addr = m_thread.GetStackFrameAtIndex(0)->GetRegisterContext()->GetPC(); + s.Address (stop_addr, m_thread.CalculateTarget()->GetArchitecture().GetAddressByteSize()); + s.PutCString (" stepping out to: "); + addr_t return_addr = return_frame->GetRegisterContext()->GetPC(); + s.Address (return_addr, m_thread.CalculateTarget()->GetArchitecture().GetAddressByteSize()); + log->Printf("%s.", s.GetData()); + } + + // StepInstruction should probably have the tri-state RunMode, but for now it is safer to + // run others. + const bool stop_others = false; + m_thread.QueueThreadPlanForStepOut(false, + NULL, + true, + stop_others, + eVoteNo, + eVoteNoOpinion, + 0); + return false; + } + else + { + if (log) + { + log->PutCString("The stack id we are stepping in changed, but our parent frame did not. " + "We are probably just confused about where we are, stopping."); + } + SetPlanComplete(); + return true; } - - // StepInstruction should probably have the tri-state RunMode, but for now it is safer to - // run others. - const bool stop_others = false; - m_thread.QueueThreadPlanForStepOut(false, - NULL, - true, - stop_others, - eVoteNo, - eVoteNoOpinion, - 0); - return false; } else { |

