From bcdc198ddb5ef21c41e76fcb14e6399ae844d807 Mon Sep 17 00:00:00 2001 From: Eldar Abusalimov Date: Tue, 1 Oct 2019 18:40:54 +0300 Subject: [PATCH] CIDR: debugger: (testing) Inline CidrDebuggingFixture.collectVars() GitOrigin-RevId: f73471e131f7c589126952d74a2aa4d77fe4da23 --- .../com/intellij/xdebugger/XDebuggerTestUtil.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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);