From 07ec2fab0250e8783cf18d8e18d2e6a7e0bd2a56 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sat, 16 Jul 2011 12:57:14 +0000 Subject: [PATCH] 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 --- .../gui/team_window/TeamWindow.cpp | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp index b1967e37e4..d50e01e70f 100644 --- a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp @@ -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); }