private static void reconstructStack(ArrayList<StackTraceEntry> sourceLocations, Node node, SourceSectionFilter sourceSectionFilter, Instrumenter instrumenter) { if (node == null || sourceSectionFilter == null) { return; } // We exclude the node itself as it will be pushed on the stack by the StackPushPopNode Node current = node.getParent(); while (current != null) { if (sourceSectionFilter.includes(current) && current.getSourceSection() != null) { sourceLocations.add(new StackTraceEntry(instrumenter, current, StackTraceEntry.STATE_INTERPRETED)); } current = current.getParent(); } }
@Override public Caller visitFrame(FrameInstance frameInstance) { // we stop at eval root stack frames if (!SuspendedEvent.isEvalRootStackFrame(DebuggerSession.this, frameInstance) && (depth++ == 0)) { return null; } Node callNode = frameInstance.getCallNode(); while (callNode != null && !SourceSectionFilter.ANY.includes(callNode)) { callNode = callNode.getParent(); } if (callNode == null) { return null; } RootNode root = callNode.getRootNode(); if (root == null || !includeInternal && root.isInternal()) { return null; } return new Caller(frameInstance, callNode); } });