aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2013-07-25 00:59:01 +0000
committerJim Ingham <jingham@apple.com>2013-07-25 00:59:01 +0000
commit454916c0169502e4c8cf0f27ab61923f8b533dd0 (patch)
treed6b17ab61063f9d034a5eb77ba8bc78ede308ef2
parent66a83563e11a4974362d71358f67e55effc13030 (diff)
downloadlldb-454916c0169502e4c8cf0f27ab61923f8b533dd0.tar.gz
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 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@187094 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/lldb/Target/ThreadPlanStepInstruction.h3
-rw-r--r--source/Target/ThreadPlanStepInstruction.cpp58
2 files changed, 39 insertions, 22 deletions
diff --git a/include/lldb/Target/ThreadPlanStepInstruction.h b/include/lldb/Target/ThreadPlanStepInstruction.h
index 7f783ffea..9210b142d 100644
--- a/include/lldb/Target/ThreadPlanStepInstruction.h
+++ b/include/lldb/Target/ThreadPlanStepInstruction.h
@@ -49,8 +49,9 @@ private:
lldb::addr_t m_instruction_addr;
bool m_stop_other_threads;
bool m_step_over;
- // This is used only for the step over case.
+ // These two are used only for the step over case.
StackID m_stack_id;
+ StackID m_parent_frame_id;
DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepInstruction);
diff --git a/source/Target/ThreadPlanStepInstruction.cpp b/source/Target/ThreadPlanStepInstruction.cpp
index f7a962ee1..b07b374e3 100644
--- a/source/Target/ThreadPlanStepInstruction.cpp
+++ b/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
{