示例#1
0
  private void setEventRequests(VirtualMachine vm) {
    EventRequestManager erm = vm.eventRequestManager();

    // Normally, we want all uncaught exceptions.  We request them
    // via the same mechanism as Commands.commandCatchException()
    // so the user can ignore them later if they are not
    // interested.
    // FIXME: this works but generates spurious messages on stdout
    //        during startup:
    //          Set uncaught java.lang.Throwable
    //          Set deferred uncaught java.lang.Throwable
    Commands evaluator = new Commands();
    evaluator.commandCatchException(new StringTokenizer("uncaught java.lang.Throwable"));

    ThreadStartRequest tsr = erm.createThreadStartRequest();
    tsr.enable();
    ThreadDeathRequest tdr = erm.createThreadDeathRequest();
    tdr.enable();
  }
  /** Create the method entry and exit event requests. */
  protected void createRequests() {
    BreakpointGroup group = getBreakpointGroup();
    if (group == null) {
      // Nothing we can do right now.
      return;
    }
    Session session = BreakpointProvider.getSession(group);
    if (session == null || !session.isConnected()) {
      // Nothing we can do right now.
      return;
    }
    EventRequestManager erm = session.getConnection().getVM().eventRequestManager();

    // Create the new requests.
    if (onStart) {
      startRequest = erm.createThreadStartRequest();
      register(startRequest);
    }

    if (onDeath) {
      deathRequest = erm.createThreadDeathRequest();
      register(deathRequest);
    }
  }