Adjust ThreadHandler's usage of CreateStackTrace().
- Limit invocations of CreateStackTrace() in ThreadHandler to only unwind the topmost frame since that's all it actually cares about anyways. Also adjust Step Over to use this functionality in order to work with the correct frame addresses, since the CPU frame pointer register isn't entirely what we want here.
This commit is contained in:
@@ -253,7 +253,7 @@ ThreadHandler::HandleThreadAction(uint32 action)
|
|||||||
|
|
||||||
if (stackTrace == NULL && cpuState != NULL) {
|
if (stackTrace == NULL && cpuState != NULL) {
|
||||||
if (fDebuggerInterface->GetArchitecture()->CreateStackTrace(
|
if (fDebuggerInterface->GetArchitecture()->CreateStackTrace(
|
||||||
fThread->GetTeam(), this, cpuState, stackTrace) == B_OK) {
|
fThread->GetTeam(), this, cpuState, stackTrace, 1) == B_OK) {
|
||||||
stackTraceReference.SetTo(stackTrace, true);
|
stackTraceReference.SetTo(stackTrace, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -324,7 +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();
|
fPreviousFrameAddress = frame->FrameAddress();
|
||||||
// step over
|
// step over
|
||||||
fStepMode = STEP_OVER;
|
fStepMode = STEP_OVER;
|
||||||
if (!_DoStepOver(frame->GetCpuState()))
|
if (!_DoStepOver(frame->GetCpuState()))
|
||||||
@@ -559,9 +559,22 @@ ThreadHandler::_HandleBreakpointHitStep(CpuState* cpuState)
|
|||||||
switch (fStepMode) {
|
switch (fStepMode) {
|
||||||
case STEP_OVER:
|
case STEP_OVER:
|
||||||
{
|
{
|
||||||
// If we're not in the same frame we started in, keep executing.
|
StackTrace* stackTrace = fThread->GetStackTrace();
|
||||||
if (cpuState->StackFramePointer() != fPreviousFrameAddress)
|
BReference<StackTrace> stackTraceReference(stackTrace);
|
||||||
{
|
|
||||||
|
if (stackTrace == NULL && cpuState != NULL) {
|
||||||
|
if (fDebuggerInterface->GetArchitecture()->CreateStackTrace(
|
||||||
|
fThread->GetTeam(), this, cpuState, stackTrace, 1)
|
||||||
|
== B_OK) {
|
||||||
|
stackTraceReference.SetTo(stackTrace, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (stackTrace != NULL) {
|
||||||
|
StackFrame* frame = stackTrace->FrameAt(0);
|
||||||
|
// If we're not in the same frame we started in,
|
||||||
|
// keep executing.
|
||||||
|
if (frame != NULL && fPreviousFrameAddress
|
||||||
|
!= stackTrace->FrameAt(0)->FrameAddress()) {
|
||||||
status_t error = _InstallTemporaryBreakpoint(
|
status_t error = _InstallTemporaryBreakpoint(
|
||||||
cpuState->InstructionPointer());
|
cpuState->InstructionPointer());
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
@@ -570,6 +583,8 @@ ThreadHandler::_HandleBreakpointHitStep(CpuState* cpuState)
|
|||||||
_RunThread(cpuState->InstructionPointer());
|
_RunThread(cpuState->InstructionPointer());
|
||||||
return true;
|
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(
|
||||||
@@ -635,7 +650,8 @@ ThreadHandler::_HandleSingleStepStep(CpuState* cpuState)
|
|||||||
|
|
||||||
if (stackTrace == NULL && cpuState != NULL) {
|
if (stackTrace == NULL && cpuState != NULL) {
|
||||||
if (fDebuggerInterface->GetArchitecture()->CreateStackTrace(
|
if (fDebuggerInterface->GetArchitecture()->CreateStackTrace(
|
||||||
fThread->GetTeam(), this, cpuState, stackTrace) == B_OK) {
|
fThread->GetTeam(), this, cpuState, stackTrace, 1)
|
||||||
|
== B_OK) {
|
||||||
stackTraceReference.SetTo(stackTrace, true);
|
stackTraceReference.SetTo(stackTrace, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user