private void disableEventRequest() { List<BreakpointRequest> breakpoint = threadRef.virtualMachine().eventRequestManager().breakpointRequests(); for (int j = 0; j < breakpoint.size(); j++) { BreakpointRequest breakpointRequest = breakpoint.get(j); breakpointRequest.setEnabled(false); } }
private void enableEventRequest() { List<BreakpointRequest> breakpoint = threadRef.virtualMachine().eventRequestManager().breakpointRequests(); for (int j = 0; j < breakpoint.size(); j++) { BreakpointRequest breakpointRequest = breakpoint.get(j); breakpointRequest.setEnabled(true); } }
@Override public List<Breakpoint> getAllBreakpoints() throws DebuggerException { List<BreakpointRequest> breakpointRequests; try { breakpointRequests = getEventManager().breakpointRequests(); } catch (DebuggerException e) { Throwable cause = e.getCause(); if (cause instanceof VMCannotBeModifiedException) { // If target VM in read-only state then list of break point always empty. return emptyList(); } throw e; } List<Breakpoint> breakPoints = new ArrayList<>(breakpointRequests.size()); for (BreakpointRequest breakpointRequest : breakpointRequests) { com.sun.jdi.Location location = breakpointRequest.location(); // Breakpoint always enabled at the moment. Managing states of breakpoint is not supported for // now. breakPoints.add( newDto(BreakpointDto.class) .withEnabled(true) .withLocation(asDto(new JdbLocation(languageServer, location)))); } breakPoints.sort(BREAKPOINT_COMPARATOR); return breakPoints; }
@Override public void deleteBreakpoint(Location location) throws DebuggerException { final String target = location.getTarget(); final String className = !target.endsWith(".java") ? target : languageServer.identifyFqnInResource(location.getTarget(), location.getLineNumber()); final int lineNumber = location.getLineNumber(); EventRequestManager requestManager = getEventManager(); List<BreakpointRequest> snapshot = new ArrayList<>(requestManager.breakpointRequests()); for (BreakpointRequest breakpointRequest : snapshot) { com.sun.jdi.Location jdiLocation = breakpointRequest.location(); if (jdiLocation.declaringType().name().equals(className) && jdiLocation.lineNumber() == lineNumber) { requestManager.deleteEventRequest(breakpointRequest); LOG.debug("Delete breakpoint: {}", location); } } List<Breakpoint> defferedByClass = deferredBreakpoints.get(className); if (defferedByClass != null) { defferedByClass.removeIf( breakpoint -> { Location l = breakpoint.getLocation(); return l.getLineNumber() == location.getLineNumber() && l.getTarget().equals(location.getTarget()); }); } }
List<BreakpointRequest> bpRequests = new ArrayList<>( erm.breakpointRequests() ); outer: for( Breakpoint bp : byLine.values() )
List<BreakpointRequest> bpRequests = new ArrayList<>( erm.breakpointRequests() ); for( BreakpointRequest req : bpRequests )
List<BreakpointRequest> bpRequests = new ArrayList<>( erm.breakpointRequests() ); for( BreakpointRequest req : bpRequests )
for (BreakpointRequest breakpointRequest : requestManager.breakpointRequests()) { if (location.equals(breakpointRequest.location())) { LOG.debug("Breakpoint at {} already set", location);