Properly handle recursive case for Step Over.
When stepping over, check to ensure that we're in the same call frame that we started in. If not, reinstate the temporary breakpoint and continue running.
This commit is contained in:
@@ -324,6 +324,7 @@ ThreadHandler::HandleThreadAction(uint32 action)
|
|||||||
fStepMode = STEP_INTO;
|
fStepMode = STEP_INTO;
|
||||||
_SingleStepThread(frame->GetCpuState()->InstructionPointer());
|
_SingleStepThread(frame->GetCpuState()->InstructionPointer());
|
||||||
} else {
|
} else {
|
||||||
|
fPreviousFrameAddress = cpuState->StackFramePointer();
|
||||||
// step over
|
// step over
|
||||||
fStepMode = STEP_OVER;
|
fStepMode = STEP_OVER;
|
||||||
if (!_DoStepOver(frame->GetCpuState()))
|
if (!_DoStepOver(frame->GetCpuState()))
|
||||||
@@ -557,6 +558,18 @@ ThreadHandler::_HandleBreakpointHitStep(CpuState* cpuState)
|
|||||||
|
|
||||||
switch (fStepMode) {
|
switch (fStepMode) {
|
||||||
case STEP_OVER:
|
case STEP_OVER:
|
||||||
|
{
|
||||||
|
// If we're in the same frame we started in, keep executing.
|
||||||
|
if (cpuState->StackFramePointer() != fPreviousFrameAddress)
|
||||||
|
{
|
||||||
|
status_t error = _InstallTemporaryBreakpoint(
|
||||||
|
cpuState->InstructionPointer());
|
||||||
|
if (error != B_OK)
|
||||||
|
_StepFallback();
|
||||||
|
else
|
||||||
|
_RunThread(cpuState->InstructionPointer());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// If we're still in the statement, we continue single-stepping,
|
// If we're still in the statement, we continue single-stepping,
|
||||||
// otherwise we're done.
|
// otherwise we're done.
|
||||||
if (fStepStatement->ContainsAddress(
|
if (fStepStatement->ContainsAddress(
|
||||||
@@ -565,11 +578,9 @@ ThreadHandler::_HandleBreakpointHitStep(CpuState* cpuState)
|
|||||||
_StepFallback();
|
_StepFallback();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
fPreviousFrameAddress = 0;
|
||||||
// TODO: this needs to handle recursive cases properly as
|
|
||||||
// STEP_OUT does, we need to have exited the statement
|
|
||||||
// *and* be back in the call frame we started in.
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
case STEP_INTO:
|
case STEP_INTO:
|
||||||
// Should never happen -- we don't set a breakpoint in this case.
|
// Should never happen -- we don't set a breakpoint in this case.
|
||||||
|
|||||||
Reference in New Issue
Block a user