private void setFilters(WatchpointRequest wr) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper { JPDAThread[] threadFilters = breakpoint.getThreadFilters(getDebugger()); if (threadFilters != null && threadFilters.length > 0) { for (JPDAThread t : threadFilters) { WatchpointRequestWrapper.addThreadFilter(wr, ((JPDAThreadImpl) t).getThreadReference()); } } ObjectVariable[] varFilters = breakpoint.getInstanceFilters(getDebugger()); if (varFilters != null && varFilters.length > 0) { for (ObjectVariable v : varFilters) { ObjectReference value = (ObjectReference) ((JDIVariable) v).getJDIValue(); if (value != null) { WatchpointRequestWrapper.addInstanceFilter(wr, value); } else { Logger.getLogger(FieldBreakpointImpl.class.getName()).log(Level.CONFIG, "", new IllegalStateException("Null instance filter of breakpoint "+breakpoint+", v = "+v)); } } } }
/** * Watch all means * 1) watch access * 2) watch modification of a field */ @Test(timeout=5000) public void testWatchAll() { try { //resetOutputs();//Uncomment this if you want to see the output on console compile("WatchAll.f3"); stop("in WatchAll.f3$run$"); WatchpointRequest watchpointReq = watch("all WatchAll.$numVar");//watch access (checks for access only, and not modifications) f3run(); WatchpointEvent wpEvent = resumeToWatchpoint(); checkWatchPointEvent(wpEvent); list(); step(); list(); wpEvent = resumeToWatchpoint(); checkWatchPointEvent(wpEvent); step(); list(); wpEvent = resumeToWatchpoint(); checkWatchPointEvent(wpEvent); resumeToVMDeath(); quit(); } catch (Exception exp) { exp.printStackTrace(); Assert.fail(exp.getMessage()); } }
public F3WatchpointRequest(F3VirtualMachine f3vm, WatchpointRequest underlying) { super(f3vm, underlying); }
@Override protected WatchpointRequest underlying() { return (WatchpointRequest) super.underlying(); }
public static F3EventRequest wrap(F3VirtualMachine f3vm, EventRequest req) { if (req == null) { return null; } if (req instanceof AccessWatchpointRequest) { return new F3AccessWatchpointRequest(f3vm, (AccessWatchpointRequest)req); } else if (req instanceof BreakpointRequest) { return new F3BreakpointRequest(f3vm, (BreakpointRequest)req); } else if (req instanceof ClassPrepareRequest) { return new F3ClassPrepareRequest(f3vm, (ClassPrepareRequest)req); } else if (req instanceof ClassUnloadRequest) { return new F3ClassUnloadRequest(f3vm, (ClassUnloadRequest)req); } else if (req instanceof ExceptionRequest) { return new F3ExceptionRequest(f3vm, (ExceptionRequest)req); } else if (req instanceof MethodEntryRequest) { return new F3MethodEntryRequest(f3vm, (MethodEntryRequest)req); } else if (req instanceof MethodExitRequest) { return new F3MethodExitRequest(f3vm, (MethodExitRequest)req); } else if (req instanceof ModificationWatchpointRequest) { return new F3ModificationWatchpointRequest(f3vm, (ModificationWatchpointRequest)req); } else if (req instanceof MonitorContendedEnterRequest) { return new F3MonitorContendedEnterRequest(f3vm, (MonitorContendedEnterRequest)req); } else if (req instanceof MonitorContendedEnteredRequest) { return new F3MonitorContendedEnteredRequest(f3vm, (MonitorContendedEnteredRequest)req); } else if (req instanceof MonitorWaitRequest) { return new F3MonitorWaitRequest(f3vm, (MonitorWaitRequest)req); } else if (req instanceof MonitorWaitedRequest) { return new F3MonitorWaitedRequest(f3vm, (MonitorWaitedRequest)req); } else if (req instanceof StepRequest) { return new F3StepRequest(f3vm, (StepRequest)req); } else if (req instanceof ThreadDeathRequest) { return new F3ThreadDeathRequest(f3vm, (ThreadDeathRequest)req); } else if (req instanceof ThreadStartRequest) { return new F3ThreadStartRequest(f3vm, (ThreadStartRequest)req); } else if (req instanceof VMDeathRequest) { return new F3VMDeathRequest(f3vm, (VMDeathRequest)req); } else if (req instanceof WatchpointRequest) { return new F3WatchpointRequest(f3vm, (WatchpointRequest)req); } else { return new F3EventRequest(f3vm, req); } }
public WatchpointRequest watch(String command) { return evaluator.commandWatch(new StringTokenizer(command)); }