use of io.flutter.vmService.frame.DartAsyncMarkerFrame in project flutter-intellij by flutter.
the class CanonicalBreakpoint method computeStackFrames.
public void computeStackFrames(@NotNull final String isolateId, final int firstFrameIndex, @NotNull final XExecutionStack.XStackFrameContainer container, @Nullable final InstanceRef exception) {
addRequest(() -> myVmService.getStack(isolateId, new GetStackConsumer() {
@Override
public void received(final Stack vmStack) {
ApplicationManager.getApplication().executeOnPooledThread(() -> {
InstanceRef exceptionToAddToFrame = exception;
// Check for async causal frames; fall back to using regular sync frames.
ElementList<Frame> elementList = vmStack.getAsyncCausalFrames();
if (elementList == null) {
elementList = vmStack.getFrames();
}
final List<Frame> vmFrames = Lists.newArrayList(elementList);
final List<XStackFrame> xStackFrames = new ArrayList<>(vmFrames.size());
for (final Frame vmFrame : vmFrames) {
if (vmFrame.getKind() == FrameKind.AsyncSuspensionMarker) {
// Render an asynchronous gap.
final XStackFrame markerFrame = new DartAsyncMarkerFrame();
xStackFrames.add(markerFrame);
} else {
final DartVmServiceStackFrame stackFrame = new DartVmServiceStackFrame(myDebugProcess, isolateId, vmFrame, vmFrames, exceptionToAddToFrame);
stackFrame.setIsDroppableFrame(vmFrame.getKind() == FrameKind.Regular);
xStackFrames.add(stackFrame);
if (!stackFrame.isInDartSdkPatchFile()) {
// The exception (if any) is added to the frame where debugger stops and to the upper frames.
exceptionToAddToFrame = null;
}
}
}
container.addStackFrames(firstFrameIndex == 0 ? xStackFrames : xStackFrames.subList(firstFrameIndex, xStackFrames.size()), true);
});
}
@Override
public void onError(final RPCError error) {
container.errorOccurred(error.getMessage());
}
@Override
public void received(Sentinel response) {
container.errorOccurred(response.getValueAsString());
}
}));
}
Aggregations