Пример #1
0
  private void commandClear(StringTokenizer t) throws NoSessionException {
    if (!t.hasMoreTokens()) {
      // Print set breakpoints
      listEventRequests();
      return;
    }
    // ### need 'clear all'
    BreakpointSpec bpSpec = parseBreakpointSpec(t.nextToken());
    if (bpSpec != null) {
      List<EventRequestSpec> specs = runtime.eventRequestSpecs();

      if (specs.isEmpty()) {
        env.notice("No breakpoints set.");
      } else {
        List<EventRequestSpec> toDelete = new ArrayList<EventRequestSpec>();
        for (EventRequestSpec spec : specs) {
          if (spec.equals(bpSpec)) {
            toDelete.add(spec);
          }
        }
        // The request used for matching should be found
        if (toDelete.size() <= 1) {
          env.notice("No matching breakpoint set.");
        }
        for (EventRequestSpec spec : toDelete) {
          runtime.delete(spec);
        }
      }
    } else {
      env.error("Ill-formed breakpoint specification.");
    }
  }
Пример #2
0
 private void listEventRequests() throws NoSessionException {
   // Print set breakpoints
   List<EventRequestSpec> specs = runtime.eventRequestSpecs();
   if (specs.isEmpty()) {
     env.notice("No breakpoints/watchpoints/exceptions set.");
   } else {
     OutputSink out = env.getOutputSink();
     out.println("Current breakpoints/watchpoints/exceptions set:");
     for (EventRequestSpec bp : specs) {
       out.println("\t" + bp);
     }
     out.show();
   }
 }