protected void commitVM(VirtualMachine vm) {
    if (!isInInitialState()) {
      logError("State is invalid " + myState.get());
    }
    DebuggerManagerThreadImpl.assertIsManagerThread();
    myPositionManager = new CompoundPositionManager(new PositionManagerImpl(this));
    myProject.getMessageBus().connect(myDisposable).subscribe(ModuleRootListener.TOPIC, new ModuleRootListener() {
      @Override
      public void rootsChanged(@NotNull final ModuleRootEvent event) {
        DumbService.getInstance(myProject).runWhenSmart(
          () -> getManagerThread().schedule(PrioritizedTask.Priority.HIGH, () -> {
            myPositionManager.clearCache();
            DebuggerSession session = mySession;
            if (session != null && session.isAttached()) {
              DebuggerUIUtil.invokeLater(() -> session.refresh(true));
            }
          }));
      }
    });
    LOG.debug("*******************VM attached******************");

    int mask = getTraceMask();
    if (mask == 0 && vm instanceof VirtualMachineImpl extendedVM) {
      if (Registry.is("debugger.log.jdi.in.unit.tests") && ApplicationManager.getApplication().isUnitTestMode()) {
        mask = VirtualMachine.TRACE_ALL;
        extendedVM.setDebugTraceConsumer(string -> LOG.debug("[JDI: " + string + "]"));
      }
    }
    vm.setDebugTraceMode(mask);

    checkVirtualMachineVersion(vm);
    myVirtualMachineProxy = new VirtualMachineProxyImpl(this, vm);
    if (ApplicationManager.getApplication().isUnitTestMode()) {
      Alarm alarm = new Alarm(myDisposable);
      alarm.addRequest(() -> myDebuggerManagerThread.schedule(PrioritizedTask.Priority.HIGH, () -> {
        logError("Long debugger test execution");
      }), 3*60*1000);
    }
  }
protected void commitVM(VirtualMachine vm)