diff --git a/platform/xdebugger-testFramework/src/com/intellij/xdebugger/XDebuggerTestUtil.java b/platform/xdebugger-testFramework/src/com/intellij/xdebugger/XDebuggerTestUtil.java index 9d1ff552ce29..63642dd9922f 100644 --- a/platform/xdebugger-testFramework/src/com/intellij/xdebugger/XDebuggerTestUtil.java +++ b/platform/xdebugger-testFramework/src/com/intellij/xdebugger/XDebuggerTestUtil.java @@ -194,13 +194,24 @@ public class XDebuggerTestUtil { return collectFramesWithSelected(thread, timeout, XDebuggerTestUtil::waitFor); } - public static Pair, XStackFrame> collectFramesWithSelected(XExecutionStack thread, long timeout, BiFunction waitFunction) { + public static Pair, XStackFrame> collectFramesWithSelected(XExecutionStack thread, + long timeout, + BiFunction waitFunction) { XTestStackFrameContainer container = new XTestStackFrameContainer(); thread.computeStackFrames(0, container); List all = container.waitFor(timeout, waitFunction).first; return Pair.create(all, container.frameToSelect); } + public static XStackFrame getFrameAt(@NotNull XDebugSession session, int frameIndex) { + final XExecutionStack activeThread = getActiveThread(session); + return getFrameAt(activeThread, frameIndex); + } + + public static XStackFrame getFrameAt(@NotNull XExecutionStack thread, int frameIndex) { + return frameIndex == 0 ? thread.getTopFrame() : collectFrames(thread).get(frameIndex); + } + @NotNull public static List collectChildren(XValueContainer value) { return collectChildren(value, XDebuggerTestUtil::waitFor);