private StepRequest createStep( ThreadReference eventThread, int depth ) { if( getEventRequestManager().stepRequests().size() > 0 ) { // Only one at a time return null; } StepRequest req = getEventRequestManager().createStepRequest( eventThread, StepRequest.STEP_LINE, depth ); req.addClassExclusionFilter( "sun.*" ); req.addClassExclusionFilter( "com.sun.*" ); //req.addClassExclusionFilter( "java.*" ); // we support dependency source now for java runtime debugging now req.addClassExclusionFilter( "gw.*" ); req.addCountFilter( 1 ); req.putProperty( FROM_LOCATION, _location ); req.enable(); return req; }
private void doStep(int depth, SuspendPolicy suspendPolicy) throws DebuggerException { lock.lock(); try { clearSteps(); StepRequest request = getEventManager().createStepRequest(getCurrentThread(), StepRequest.STEP_LINE, depth); request.addCountFilter(1); request.setSuspendPolicy(toSuspendEventRequest(suspendPolicy)); request.enable(); resume(newDto(ResumeActionDto.class)); } finally { lock.unlock(); } }
private void disableStepRequests(JPDAThread thread) { ThreadReference tr; try { tr = (ThreadReference) thread.getClass().getMethod("getThreadReference").invoke(thread); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException ex) { Exceptions.printStackTrace(ex); return ; } try { VirtualMachine vm = tr.virtualMachine(); if (vm == null) return; EventRequestManager erm = vm.eventRequestManager(); List<StepRequest> l = erm.stepRequests(); for (StepRequest stepRequest : l) { if (stepRequest.thread().equals(tr)) { try { stepRequest.disable(); } catch (InvalidRequestStateException ex) {} } } } catch (VMDisconnectedException | InternalException | IllegalThreadStateException | InvalidRequestStateException e) { } }
private static StepRequest createStepRequest(ThreadReference thread, int stepSize, int stepDepth, String[] stepFilters) { StepRequest request = thread.virtualMachine().eventRequestManager().createStepRequest(thread, stepSize, stepDepth); if (stepFilters != null) { for (String stepFilter : stepFilters) { request.addClassExclusionFilter(stepFilter); } } request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); request.addCountFilter(1); return request; }
private void stepIntoThread(ThreadReference thread) { StepRequest request = DebugUtility.createStepIntoRequest(thread, this.context.getStepFilters().classNameFilters); currentDebugSession.getEventHub().stepEvents().filter(debugEvent -> request.equals(debugEvent.event.request())) .take(1).subscribe(debugEvent -> { debugEvent.shouldResume = false; // Have to send to events to keep the UI sync with the step in operations: context.getProtocolServer().sendEvent(new Events.StoppedEvent("step", thread.uniqueID())); context.getProtocolServer().sendEvent(new Events.ContinuedEvent(thread.uniqueID())); }); request.enable(); thread.resume(); }
private void clearSteps() throws DebuggerException { List<StepRequest> snapshot = new ArrayList<>(getEventManager().stepRequests()); for (StepRequest stepRequest : snapshot) { if (stepRequest.thread().equals(getCurrentThread())) { getEventManager().deleteEventRequest(stepRequest); } } }
if( ((StepRequest)request).depth() == StepRequest.STEP_INTO ) step.putProperty( BACK_OUT_LOCATION, request.getProperty( FROM_LOCATION ) );
private void stepInto(IDebugAdapterContext context, ThreadReference thread) { StepRequest request = DebugUtility.createStepIntoRequest(thread, context.getStepFilters().classNameFilters); context.getDebugSession().getEventHub().stepEvents().filter(debugEvent -> request.equals(debugEvent.event.request())).take(1).subscribe(debugEvent -> { debugEvent.shouldResume = false; // Have to send two events to keep the UI sync with the step in operations: context.getProtocolServer().sendEvent(new Events.ContinuedEvent(thread.uniqueID())); context.getProtocolServer().sendEvent(new Events.StoppedEvent("restartframe", thread.uniqueID())); }); request.enable(); thread.resume(); } }
context.getStepFilters().classNameFilters); threadState.pendingStepRequest.enable(); DebugUtility.resumeThread(thread);