Resolve TODO: If a function is selected by other means than the stack

trace view, but we have a call frame matching that function, then jump
to that frame in the stack trace view as well.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42437 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent
2011-07-16 12:57:14 +00:00
parent eadad13a4f
commit 07ec2fab02
@@ -743,9 +743,6 @@ TeamWindow::_SetActiveBreakpoint(UserBreakpoint* breakpoint)
void
TeamWindow::_SetActiveFunction(FunctionInstance* functionInstance)
{
// TODO: If a function is selected by other means than via selecting a stack
// frame, we should still select a matching stack frame, if it features the
// same function.
if (functionInstance == fActiveFunction)
return;
@@ -792,6 +789,26 @@ TeamWindow::_SetActiveFunction(FunctionInstance* functionInstance)
_SetActiveSourceCode(sourceCode);
fImageFunctionsView->SetFunction(fActiveFunction);
locker.Lock();
// look if our current stack trace has a frame matching the selected
// function. If so, set it to match.
StackFrame* matchingFrame = NULL;
if (fActiveStackTrace != NULL) {
for (int32 i = 0; i < fActiveStackTrace->CountFrames(); i++) {
StackFrame* frame = fActiveStackTrace->FrameAt(i);
if (frame->Function() == fActiveFunction) {
matchingFrame = frame;
break;
}
}
}
locker.Unlock();
if (matchingFrame != NULL)
_SetActiveStackFrame(matchingFrame);
}