synchronized void remove() { if (isResolved()) { Env.vm().eventRequestManager().deleteEventRequest(resolved()); } if (refSpec instanceof PatternReferenceTypeSpec) { PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec; if (! prs.isUnique()){ /* * This is a class pattern. Track down and delete * all EventRequests matching this spec. * Note: Class patterns apply only to ExceptionRequests, * so that is all we need to examine. */ ArrayList<ExceptionRequest> deleteList = new ArrayList<ExceptionRequest>(); for (ExceptionRequest er : Env.vm().eventRequestManager().exceptionRequests()) { if (prs.matches(er.exception())) { deleteList.add (er); } } Env.vm().eventRequestManager().deleteEventRequests(deleteList); } } }
public void processClassPrepare(DebugProcess process, ReferenceType refType) { DebugProcessImpl debugProcess = (DebugProcessImpl)process; if (!isEnabled()) { return; } // trying to create a request ExceptionRequest request = debugProcess.getRequestsManager().createExceptionRequest(this, refType, isNotifyCaught(), isNotifyUncaught()); debugProcess.getRequestsManager().enableRequest(request); if (LOG.isDebugEnabled()) { if (refType != null) { LOG.debug("Created exception request for reference type " + refType.name()); } else { LOG.debug("Created exception request for reference type null"); } } }
synchronized void remove() { if (isResolved()) { env.vm().eventRequestManager().deleteEventRequest(resolved()); } if (refSpec instanceof PatternReferenceTypeSpec) { PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec; if (! prs.isUnique()){ /* * This is a class pattern. Track down and delete * all EventRequests matching this spec. * Note: Class patterns apply only to ExceptionRequests, * so that is all we need to examine. */ ArrayList<ExceptionRequest> deleteList = new ArrayList<ExceptionRequest>(); for (ExceptionRequest er : env.vm().eventRequestManager().exceptionRequests()) { if (prs.matches(er.exception())) { deleteList.add (er); } } env.vm().eventRequestManager().deleteEventRequests(deleteList); } } }
/** * Try to throw an exception without a try catch block. Tell the debugger to catch the Exception * which anyways breaks after the exception event is caught, then we analyze it. */ @Test(timeout=5000) public void testExceptionBreak() { try { resetOutputs();//Uncomment this if you want to see the output on console compile("ExceptionBreak.f3"); stop("in ExceptionBreak:2"); stop("in ExceptionBreak:6"); f3run(); ExceptionRequest exceptionReq = catchException("java.lang.Exception"); resumeToBreakpoint();//Change the above call to catchException("somejunk") ,this TC doesn't work. list(); checkExceptionEvent();// This should be ExceptionEvent or ThreadStartEvent checkExceptionEvent();// This should be ExceptionEvent or ThreadStartEvent cont(); quit(); } catch (Exception exp) { exp.printStackTrace(); Assert.fail(exp.getMessage()); } }
public void processClassPrepare(DebugProcess process, ReferenceType refType) { DebugProcessImpl debugProcess = (DebugProcessImpl)process; if (!ENABLED) { return; } // trying to create a request ExceptionRequest request = debugProcess.getRequestsManager().createExceptionRequest(this, refType, NOTIFY_CAUGHT, NOTIFY_UNCAUGHT); debugProcess.getRequestsManager().enableRequest(request); if (LOG.isDebugEnabled()) { if (refType != null) { LOG.debug("Created exception request for reference type " + refType.name()); } else { LOG.debug("Created exception request for reference type null"); } } }
@Override protected ExceptionRequest createEventRequest(EventRequest oldRequest) throws VMDisconnectedExceptionWrapper, InternalExceptionWrapper { ExceptionRequest excRequest = (ExceptionRequest) oldRequest; ExceptionRequest er = EventRequestManagerWrapper.createExceptionRequest ( getEventRequestManager(), ExceptionRequestWrapper.exception(excRequest), ExceptionRequestWrapper.notifyCaught(excRequest), ExceptionRequestWrapper.notifyUncaught(excRequest) ); addFilters(er, breakpoint.getClassFilters(), breakpoint.getClassExclusionFilters()); return er; }
private void addFilters(ExceptionRequest er, String[] classFilters, String[] classExclusionFilters) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper { int i, k = classFilters.length; for (i = 0; i < k; i++) { ExceptionRequestWrapper.addClassFilter (er, classFilters [i]); } k = classExclusionFilters.length; for (i = 0; i < k; i++) { ExceptionRequestWrapper.addClassExclusionFilter (er, classExclusionFilters [i]); } }
@Override public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught) { EventRequestManager manager = vm.eventRequestManager(); ArrayList<ExceptionRequest> legacy = new ArrayList<>(manager.exceptionRequests()); manager.deleteEventRequests(legacy); // When no exception breakpoints are requested, no need to create an empty exception request. if (notifyCaught || notifyUncaught) { ExceptionRequest request = manager.createExceptionRequest(null, notifyCaught, notifyUncaught); request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); request.enable(); } }
public static List<ExceptionRequest> wrapExceptionRequests( F3VirtualMachine f3vm, List<ExceptionRequest> reqs) { if (reqs == null) { return null; } List<ExceptionRequest> result = new ArrayList<ExceptionRequest>(); for (ExceptionRequest req : reqs) { result.add(wrap(f3vm, req)); } return result; }
/** * Create the desired event requests, and enable * them so that we will get events. * @param excludes Class patterns for which we don't want events * @param watchFields Do we want to watch assignments to fields */ void setEventRequests() { EventRequestManager mgr = vm.eventRequestManager(); ExceptionRequest excReq = mgr.createExceptionRequest(null,true, true); excReq.setSuspendPolicy(EventRequest.SUSPEND_ALL); excReq.enable(); MethodEntryRequest menr = mgr.createMethodEntryRequest(); for (int i=0; i<excludes.size(); ++i) { menr.addClassExclusionFilter(excludes.get(i)); } menr.setSuspendPolicy(EventRequest.SUSPEND_ALL); menr.enable(); MethodExitRequest mexr = mgr.createMethodExitRequest(); for (int i=0; i<excludes.size(); ++i) { mexr.addClassExclusionFilter(excludes.get(i)); } mexr.setSuspendPolicy(EventRequest.SUSPEND_ALL); mexr.enable(); ThreadDeathRequest tdr = mgr.createThreadDeathRequest(); tdr.setSuspendPolicy(EventRequest.SUSPEND_ALL); tdr.enable(); }
public ExceptionRequest createExceptionRequest(ReferenceType refType, boolean notifyCaught, boolean notifyUncaught) { validateMirrorOrNull(refType); return new ExceptionRequestImpl(refType, notifyCaught, notifyUncaught); }
public List<ExceptionRequest> exceptionRequests() { return (List<ExceptionRequest>)unmodifiableRequestList(JDWP.EventKind.EXCEPTION); }
public F3ExceptionRequest(F3VirtualMachine f3vm, ExceptionRequest underlying) { super(f3vm, underlying); }
@Override protected ExceptionRequest underlying() { return (ExceptionRequest) super.underlying(); }
public List<ExceptionRequest> exceptionRequests() { return F3EventRequest.wrapExceptionRequests(virtualMachine(), underlying().exceptionRequests()); }
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 static F3ExceptionRequest wrap( F3VirtualMachine f3vm, ExceptionRequest req) { return (req == null)? null : new F3ExceptionRequest(f3vm, req); }
/** * This is similar to "catch" command of "jdb". * Returns null for deferred events. */ public ExceptionRequest catchException(String command) { return evaluator.commandCatchException(new StringTokenizer(command)); }