コード例 #1
0
  public void handleIsolate(
      @NotNull final IsolateRef isolateRef, final boolean isolatePausedStart) {
    // We should auto-resume on a StartPaused event, if we're not remote debugging, and after
    // breakpoints have been set.

    final boolean newIsolate = myIsolatesInfo.addIsolate(isolateRef);

    if (isolatePausedStart) {
      myIsolatesInfo.setShouldInitialResume(isolateRef);
    }

    // Just to make sure that the main isolate is not handled twice, both from
    // handleDebuggerConnected() and DartVmServiceListener.received(PauseStart)
    if (newIsolate) {
      addRequest(
          () ->
              myVmService.setExceptionPauseMode(
                  isolateRef.getId(),
                  ExceptionPauseMode.Unhandled,
                  new VmServiceConsumers.SuccessConsumerWrapper() {
                    @Override
                    public void received(Success response) {
                      setInitialBreakpointsAndResume(isolateRef);
                    }
                  }));
    } else {
      checkInitialResume(isolateRef);
    }
  }
コード例 #2
0
  private void doSetInitialBreakpointsAndResume(@NotNull final IsolateRef isolateRef) {
    final Set<XLineBreakpoint<XBreakpointProperties>> xBreakpoints =
        myBreakpointHandler.getXBreakpoints();

    if (xBreakpoints.isEmpty()) {
      myIsolatesInfo.setBreakpointsSet(isolateRef);
      checkInitialResume(isolateRef);
      return;
    }

    final AtomicInteger counter = new AtomicInteger(xBreakpoints.size());

    for (final XLineBreakpoint<XBreakpointProperties> xBreakpoint : xBreakpoints) {
      addBreakpoint(
          isolateRef.getId(),
          xBreakpoint.getSourcePosition(),
          new VmServiceConsumers.BreakpointConsumerWrapper() {
            @Override
            void sourcePositionNotApplicable() {
              checkDone();
            }

            @Override
            public void received(Breakpoint vmBreakpoint) {
              myBreakpointHandler.vmBreakpointAdded(xBreakpoint, isolateRef.getId(), vmBreakpoint);
              checkDone();
            }

            @Override
            public void onError(RPCError error) {
              myBreakpointHandler.breakpointFailed(xBreakpoint);
              checkDone();
            }

            private void checkDone() {
              if (counter.decrementAndGet() == 0) {
                myIsolatesInfo.setBreakpointsSet(isolateRef);
                checkInitialResume(isolateRef);
              }
            }
          });
    }
  }
コード例 #3
0
 public void handleIsolatePausedOnStart(@NotNull final IsolateRef isolateRef) {
   // Just to make sure that the main isolate is not handled twice, both from
   // handleDebuggerConnected() and DartVmServiceListener.received(PauseStart)
   if (myIsolatesInfo.addIsolate(isolateRef)) {
     addRequest(
         new Runnable() {
           @Override
           public void run() {
             myVmService.setExceptionPauseMode(
                 isolateRef.getId(),
                 ExceptionPauseMode.Unhandled,
                 new VmServiceConsumers.SuccessConsumerWrapper() {
                   @Override
                   public void received(Success response) {
                     setInitialBreakpointsAndResume(isolateRef.getId());
                   }
                 });
           }
         });
   }
 }
コード例 #4
0
 private void checkInitialResume(IsolateRef isolateRef) {
   if (myIsolatesInfo.getShouldInitialResume(isolateRef)) {
     resumeIsolate(isolateRef.getId(), null);
   }
 }