@NotNull @Override public List<ClassPrepareRequest> createPrepareRequests(@NotNull final ClassPrepareRequestor requestor, @NotNull final SourcePosition position) { return iterate(new Processor<List<ClassPrepareRequest>>() { @Override public List<ClassPrepareRequest> process(PositionManager positionManager) throws NoDataException { if (positionManager instanceof MultiRequestPositionManager) { return ((MultiRequestPositionManager)positionManager).createPrepareRequests(requestor, position); } else { ClassPrepareRequest prepareRequest = positionManager.createPrepareRequest(requestor, position); if (prepareRequest == null) { return Collections.emptyList(); } return Collections.singletonList(prepareRequest); } } }, Collections.<ClassPrepareRequest>emptyList()); }
private void deferBreakpoint(String className, Breakpoint breakpoint) throws DebuggerException { List<Breakpoint> newList = new ArrayList<>(); List<Breakpoint> list = deferredBreakpoints.putIfAbsent(className, newList); if (list == null) { list = newList; } list.add(breakpoint); // start listening for the load of the type if (!classPrepareRequests.containsKey(className)) { ClassPrepareRequest request = getEventManager().createClassPrepareRequest(); // set class filter in order to reduce the amount of event traffic sent from the target VM to // the debugger VM request.addClassFilter(className); request.enable(); classPrepareRequests.put(className, request); } LOG.debug("Deferred breakpoint: {}", breakpoint.getLocation().toString()); }
private boolean processClassPrepareEvent(com.sun.jdi.event.ClassPrepareEvent event) throws DebuggerException { setCurrentThread(event.thread()); final String className = event.referenceType().name(); // add deferred breakpoints List<Breakpoint> breakpointsToAdd = deferredBreakpoints.get(className); if (breakpointsToAdd != null) { for (Breakpoint b : breakpointsToAdd) { addBreakpoint(b); } deferredBreakpoints.remove(className); // All deferred breakpoints for className have been already added, // so no need to listen for an appropriate ClassPrepareRequests any more. ClassPrepareRequest request = classPrepareRequests.remove(className); if (request != null) { getEventManager().deleteEventRequest(request); } } return true; }
public ClassPrepareRequest createPrepareRequest(final ClassPrepareRequestor requestor, final SourcePosition position) throws NoDataException { String qName = getOuterClassName(position); if (qName != null) { return myDebugProcess.getRequestsManager().createClassPrepareRequest(requestor, qName); } qName = findEnclosingName(position); if (qName == null) throw new NoDataException(); ClassPrepareRequestor waitRequestor = new ClassPrepareRequestor() { public void processClassPrepare(DebugProcess debuggerProcess, ReferenceType referenceType) { final CompoundPositionManager positionManager = ((DebugProcessImpl)debuggerProcess).getPositionManager(); if (positionManager.locationsOfLine(referenceType, position).size() > 0) { requestor.processClassPrepare(debuggerProcess, referenceType); } } }; return myDebugProcess.getRequestsManager().createClassPrepareRequest(waitRequestor, qName + "$*"); }
protected void createRequest() { final EventRequestManager manager = owner.getEventRequestManager(); if (manager != null) { try { final ClassPrepareRequest request = manager.createClassPrepareRequest(); owner.jdiManager().modelFilter().filter(request); request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); request.enable(); owner.addJDIEventListener(this, request); } catch (final RuntimeException e) { JiveDebugPlugin.log(e); } } }
@Override public ClassPrepareRequest createPrepareRequest() { ClassPrepareRequest request = Env.vm().eventRequestManager().createClassPrepareRequest(); request.addClassFilter(classId); request.addCountFilter(1); return request; }
private static void addClassWatch(VirtualMachine vm) { EventRequestManager erm = vm.eventRequestManager(); ClassPrepareRequest classPrepareRequest = erm .createClassPrepareRequest(); classPrepareRequest.addClassFilter(CLASS_NAME); classPrepareRequest.setEnabled(true); }
@Override public ClassPrepareRequest createPrepareRequest(@NotNull final ClassPrepareRequestor requestor, @NotNull final SourcePosition position) throws NoDataException { checkSourcePositionFileType(position); return myDebugProcess.getRequestsManager().createClassPrepareRequest(new ClassPrepareRequestor() { @Override public void processClassPrepare(DebugProcess debuggerProcess, ReferenceType referenceType) { onClassPrepare(debuggerProcess, referenceType, position, requestor); } }, GENERATED_CLASS_PATTERN); }
@Override public ClassPrepareRequest createPrepareRequest(@NotNull final ClassPrepareRequestor requestor, @NotNull final SourcePosition position) { return iterate(new Processor<ClassPrepareRequest>() { @Override public ClassPrepareRequest process(PositionManager positionManager) throws NoDataException { return positionManager.createPrepareRequest(requestor, position); } }, null); }
@Override public ClassPrepareRequest createPrepareRequest(@NotNull final ClassPrepareRequestor requestor, @NotNull final SourcePosition position) throws NoDataException { if (LOG.isDebugEnabled()) { LOG.debug("createPrepareRequest: " + position); } checkGroovyFile(position); String qName = getOuterClassName(position); if (qName != null) { return myDebugProcess.getRequestsManager().createClassPrepareRequest(requestor, qName); } qName = findEnclosingName(position); if (qName == null) throw NoDataException.INSTANCE; ClassPrepareRequestor waitRequestor = new ClassPrepareRequestor() { @Override public void processClassPrepare(DebugProcess debuggerProcess, ReferenceType referenceType) { final CompoundPositionManager positionManager = ((DebugProcessImpl)debuggerProcess).getPositionManager(); if (!positionManager.locationsOfLine(referenceType, position).isEmpty()) { requestor.processClassPrepare(debuggerProcess, referenceType); } } }; return myDebugProcess.getRequestsManager().createClassPrepareRequest(waitRequestor, qName + "$*"); }
@Override public ClassPrepareRequest createPrepareRequest(@NotNull ClassPrepareRequestor requestor, @NotNull SourcePosition position) throws NoDataException { String className = getOuterClassName(position); if (className == null) { throw NoDataException.INSTANCE; } return myDebugProcess.getRequestsManager().createClassPrepareRequest(requestor, className + "*"); }
public static List<ClassPrepareRequest> wrapClassPrepareRequests( F3VirtualMachine f3vm, List<ClassPrepareRequest> reqs) { if (reqs == null) { return null; } List<ClassPrepareRequest> result = new ArrayList<ClassPrepareRequest>(); for (ClassPrepareRequest req : reqs) { result.add(wrap(f3vm, req)); } return result; }
public ClassPrepareRequest createPrepareRequest() { ClassPrepareRequest request = env.vm().eventRequestManager().createClassPrepareRequest(); request.addClassFilter(classId); request.addCountFilter(1); return request; }
public ClassPrepareEvent resumeToPrepareOf(String className) { final ClassPrepareRequest request = eventRequestManager().createClassPrepareRequest(); request.addClassFilter(className); request.addCountFilter(1); request.enable(); return (ClassPrepareEvent)resumeToEvent(request); }
@SuppressWarnings("unchecked") private void init(String[] args) throws Exception { /* * TODO As currently jdb just supports "jdb -attach [port]" command, * more work to do to parse the jdb launching command option */ if (args.length >= 2 && args[0].equals("-attach")) { SocketAttachingConnectorImpl sac = new SocketAttachingConnectorImpl( (VirtualMachineManagerImpl) Bootstrap. virtualMachineManager()); Map argMap = sac.defaultArguments(); Connector.Argument value; value = (Connector.Argument) argMap.get("hostname"); value.setValue("localhost"); value = (Connector.Argument) argMap.get("port"); value.setValue(args[1]); debuggee = sac.attach(argMap); //VMProcess = debuggee.process(); } else { System.out.println("Wrong command option. " + "The jdb currently only support jdb -attach [port]."); System.exit(0); } eventRequestManager = debuggee.eventRequestManager(); // Enable class prepare request for all classes ClassPrepareRequest classPrepareRequest = eventRequestManager.createClassPrepareRequest(); classPrepareRequest.addClassFilter("*"); classPrepareRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL); classPrepareRequest.enable(); // Enable thread start request for all threads ThreadStartRequest threadStartRequest = eventRequestManager.createThreadStartRequest(); threadStartRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); threadStartRequest.enable(); }
public ClassPrepareRequest createPrepareRequest(final ClassPrepareRequestor requestor, final SourcePosition position) throws NoDataException { checkSourcePositionFileType(position); return myDebugProcess.getRequestsManager().createClassPrepareRequest(new ClassPrepareRequestor() { public void processClassPrepare(DebugProcess debuggerProcess, ReferenceType referenceType) { onClassPrepare(debuggerProcess, referenceType, position, requestor); } }, GENERATED_CLASS_PATTERN); }
public ClassPrepareRequest createPrepareRequest(ClassPrepareRequestor requestor, SourcePosition position) { for (PositionManager positionManager : myPositionManagers) { try { return positionManager.createPrepareRequest(requestor, position); } catch (NoDataException ignored) { } } return null; }
@Override public ClassPrepareRequest createPrepareRequest(ClassPrepareRequestor requestor, SourcePosition position) throws NoDataException { String className = getOuterClassName(position); if (className == null) { throw new NoDataException(); } return myDebugProcess.getRequestsManager().createClassPrepareRequest(requestor, className + "*"); }
public ClassPrepareRequest createClassPrepareRequest() { return new ClassPrepareRequestImpl(); }