コード例 #1
0
  /** Second part of debugger start procedure. */
  private void startDebugger() {
    threadManager = new ThreadManager(this);

    setBreakpoints();
    updateWatches();
    println(bundle.getString("CTL_Debugger_running"), STL_OUT);
    setDebuggerState(DEBUGGER_RUNNING);

    virtualMachine.resume();

    // start refresh thread .................................................
    if (debuggerThread != null) debuggerThread.stop();
    debuggerThread =
        new Thread(
            new Runnable() {
              public void run() {
                for (; ; ) {
                  try {
                    Thread.sleep(5000);
                  } catch (InterruptedException ex) {
                  }
                  if (getState() == DEBUGGER_RUNNING) threadGroup.refresh();
                }
              }
            },
            "Debugger refresh thread"); // NOI18N
    debuggerThread.setPriority(Thread.MIN_PRIORITY);
    debuggerThread.start();
  }
コード例 #2
0
 /** Disconnects from running debugged process. */
 public void disconnect() throws DebuggerException {
   if (breakpointMain != null) {
     for (int x = 0; x < breakpointMain.length; x++) breakpointMain[x].remove();
     breakpointMain = null;
   }
   try {
     if (virtualMachine != null) virtualMachine.dispose();
   } catch (VMDisconnectedException e) {
   }
   if (threadManager != null) threadManager.finish();
   if (debuggerThread != null) {
     debuggerThread.interrupt();
     debuggerThread.stop();
   }
   super.finishDebugger();
 }
コード例 #3
0
  public void dispose() {
    try {
      myVirtualMachine.dispose();
    } catch (UnsupportedOperationException e) {
      LOG.info(e);
    }

    // Memory leak workaround, see IDEA-163334
    TargetVM target =
        ReflectionUtil.getField(
            myVirtualMachine.getClass(), myVirtualMachine, TargetVM.class, "target");
    if (target != null) {
      Thread controller =
          ReflectionUtil.getField(target.getClass(), target, Thread.class, "eventController");
      if (controller != null) {
        controller.stop();
      }
    }
  }