Author: anevilyak Date: 2011-07-16 14:57:14 +0200 (Sat, 16 Jul 2011) New Revision: 42437 Changeset: https://dev.haiku-os.org/changeset/42437 Modified: haiku/trunk/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp Log: 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. Modified: haiku/trunk/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp =================================================================== --- haiku/trunk/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp 2011-07-16 11:18:54 UTC (rev 42436) +++ haiku/trunk/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp 2011-07-16 12:57:14 UTC (rev 42437) @@ -743,9 +743,6 @@ 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 @@ _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); }