com.sun.jdi.request.StepRequest Java Examples
The following examples show how to use
com.sun.jdi.request.StepRequest.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DebugUtility.java From java-debug with Eclipse Public License 1.0 | 6 votes |
private static StepRequest createStepRequest(ThreadReference thread, int stepSize, int stepDepth, String[] classFilters, String[] classExclusionFilters) { StepRequest request = thread.virtualMachine().eventRequestManager().createStepRequest(thread, stepSize, stepDepth); if (classFilters != null) { for (String classFilter : classFilters) { request.addClassFilter(classFilter); } } if (classExclusionFilters != null) { for (String exclusionFilter : classExclusionFilters) { request.addClassExclusionFilter(exclusionFilter); } } request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); request.addCountFilter(1); return request; }
Example #2
Source File: JPDAStepImpl.java From netbeans with Apache License 2.0 | 6 votes |
/** * Test whether the method is considered to be synthetic * @param m The method * @param loc The current location in that method * @return 0 when not synthetic * positive when suggested step depth is returned * negative when is synthetic and no further step depth is suggested. */ public static int isSyntheticMethod(Method m, Location loc) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper { String name = TypeComponentWrapper.name(m); if (name.startsWith("lambda$")) { // NOI18N int lineNumber = LocationWrapper.lineNumber(loc); if (lineNumber == 1) { // We're in the initialization of the Lambda. We need to step over it. return StepRequest.STEP_OVER; } return 0; // Do not treat Lambda methods as synthetic, because they contain user code. } else { // Do check the class for being Lambda synthetic class: ReferenceType declaringType = LocationWrapper.declaringType(loc); try { String className = ReferenceTypeWrapper.name(declaringType); if (className.contains("$$Lambda$")) { // NOI18N // Lambda synthetic class return -1; } } catch (ObjectCollectedExceptionWrapper ex) { } } return TypeComponentWrapper.isSynthetic(m) ? -1 : 0; }
Example #3
Source File: JPDAStepImpl.java From netbeans with Apache License 2.0 | 6 votes |
private void stepDone(EventRequest er) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper { JPDAThreadImpl t; if (er instanceof StepRequest) { StepRequest sr = (StepRequest) er; t = ((JPDADebuggerImpl) debugger).getThread(StepRequestWrapper.thread(sr)); } else { ThreadReference tr = (ThreadReference) EventRequestWrapper.getProperty(er, "thread"); // NOI18N if (tr != null) { t = ((JPDADebuggerImpl) debugger).getThread(tr); } else { t = null; } } if (t != null) { t.setInStep(false, null); } }
Example #4
Source File: RestartFrameHandler.java From java-debug with Eclipse Public License 1.0 | 5 votes |
private void stepInto(IDebugAdapterContext context, ThreadReference thread) { StepRequest request = DebugUtility.createStepIntoRequest(thread, context.getStepFilters().allowClasses, context.getStepFilters().skipClasses); 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(); }
Example #5
Source File: JDIExampleDebugger.java From tutorials with MIT License | 5 votes |
/** * Enables step request for a break point * @param vm * @param event */ public void enableStepRequest(VirtualMachine vm, BreakpointEvent event) { //enable step request for last break point if(event.location().toString().contains(debugClass.getName()+":"+breakPointLines[breakPointLines.length-1])) { StepRequest stepRequest = vm.eventRequestManager().createStepRequest(event.thread(), StepRequest.STEP_LINE, StepRequest.STEP_OVER); stepRequest.enable(); } }
Example #6
Source File: JavaHotCodeReplaceProvider.java From java-debug with Eclipse Public License 1.0 | 5 votes |
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(); }
Example #7
Source File: JPDAStepImpl.java From netbeans with Apache License 2.0 | 5 votes |
private boolean setUpBoundaryStepRequest(EventRequestManager erm, ThreadReference trRef, boolean isNextOperationFromDifferentExpression) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper, ObjectCollectedExceptionWrapper { boundaryStepRequest = EventRequestManagerWrapper.createStepRequest( erm, trRef, StepRequest.STEP_LINE, StepRequest.STEP_OVER ); if (isNextOperationFromDifferentExpression) { EventRequestWrapper.addCountFilter(boundaryStepRequest, 2); } else { EventRequestWrapper.addCountFilter(boundaryStepRequest, 1); } ((JPDADebuggerImpl) debugger).getOperator().register(boundaryStepRequest, this); EventRequestWrapper.setSuspendPolicy(boundaryStepRequest, debugger.getSuspend()); try { EventRequestWrapper.enable (boundaryStepRequest); requestsToCancel.add(boundaryStepRequest); } catch (IllegalThreadStateException itsex) { // the thread named in the request has died. ((JPDADebuggerImpl) debugger).getOperator().unregister(boundaryStepRequest); boundaryStepRequest = null; return false; } catch (InvalidRequestStateExceptionWrapper ex) { Exceptions.printStackTrace(ex); ((JPDADebuggerImpl) debugger).getOperator().unregister(boundaryStepRequest); boundaryStepRequest = null; return false; } return true; }
Example #8
Source File: Operator.java From netbeans with Apache License 2.0 | 5 votes |
/** * Removes binding between the specified event request and a registered object. * * @param req request * @see #register */ public synchronized void unregister (EventRequest req) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper { Executor e = (Executor) EventRequestWrapper.getProperty(req, "executor"); EventRequestWrapper.putProperty (req, "executor", null); // NOI18N if (e != null) { e.removed(req); } if (req instanceof StepRequest) { ThreadReference tr = StepRequestWrapper.thread((StepRequest) req); debugger.getThread(tr).setInStep(false, null); } }
Example #9
Source File: StepIntoNextMethod.java From netbeans with Apache License 2.0 | 5 votes |
private void addPatternsToRequest (String[] patterns, StepRequest stepRequest) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper { if (stepRequest == null) return; int i, k = patterns.length; for (i = 0; i < k; i++) { try { StepRequestWrapper.addClassExclusionFilter(stepRequest, patterns [i]); } catch (InvalidRequestStateException irex) { // The request is gone - ignore return ; } smartLogger.log(Level.FINER, " add pattern: {0}", patterns[i]); } }
Example #10
Source File: StepActionProvider.java From netbeans with Apache License 2.0 | 5 votes |
private static int getJDIAction (Object action) { if (action == ActionsManager.ACTION_STEP_OUT) return StepRequest.STEP_OUT; if (action == ActionsManager.ACTION_STEP_OVER) return StepRequest.STEP_OVER; throw new IllegalArgumentException (); }
Example #11
Source File: StepIntoNextMethod.java From netbeans with Apache License 2.0 | 4 votes |
private StepRequest setStepRequest (int step, JPDAThreadImpl[] resumeThreadPtr) { return setStepRequest(step, StepRequest.STEP_LINE, resumeThreadPtr); }
Example #12
Source File: Env.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
static void addExcludes(StepRequest request) { for (String pattern : excludes()) { request.addClassExclusionFilter(pattern); } }
Example #13
Source File: DecisionProcedureGuidanceJDI.java From jbse with GNU General Public License v3.0 | 4 votes |
/** * Does a single execution step of the concrete state. * * @param doStepInto if {@code true} and the current bytecode is an INVOKEX bytecode, * steps into the invoked method; if {@code false} and the current bytecode is * an INVOKEX bytecode, steps over. * @throws GuidanceException */ private void doStep(boolean doStepInto) throws GuidanceException { final int stepDepth = doStepInto ? StepRequest.STEP_INTO : StepRequest.STEP_OVER; final ThreadReference thread = this.methodEntryEvent.thread(); final EventRequestManager mgr = this.vm.eventRequestManager(); final StepRequest sr = mgr.createStepRequest(thread, StepRequest.STEP_MIN, stepDepth); sr.enable(); //if we are at an ILOAD bytecode followed by an XALOAD, //we store the value from the variable because it is used //as XALOAD index final int currentCodeIndex = getCurrentCodeIndex(); final byte[] bc = getCurrentBytecode(); final byte currentOpcode = bc[currentCodeIndex]; if (currentOpcode == OP_ILOAD || (OP_ILOAD_0 <= currentOpcode && currentOpcode <= OP_ILOAD_3)) { final boolean wide = (this.previousCodeIndex >= 0 && bc[this.previousCodeIndex] == OP_WIDE); final int nextCodeIndex; if (currentOpcode == OP_ILOAD) { nextCodeIndex = currentCodeIndex + (wide ? XLOADSTORE_IMMEDIATE_WIDE_OFFSET : XLOADSTORE_IMMEDIATE_OFFSET); } else { nextCodeIndex = currentCodeIndex + XLOADSTORE_IMPLICIT_OFFSET; } final byte opcodeNext = bc[nextCodeIndex]; if (OP_IALOAD <= opcodeNext && opcodeNext <= OP_SALOAD) { //determines the index of the local variable final int localVariableIndex; if (currentOpcode == OP_ILOAD_0) { localVariableIndex = 0; } else if (currentOpcode == OP_ILOAD_1) { localVariableIndex = 1; } else if (currentOpcode == OP_ILOAD_2) { localVariableIndex = 2; } else if (currentOpcode == OP_ILOAD_3) { localVariableIndex = 3; } else { localVariableIndex = (wide ? byteCat(bc[currentCodeIndex + 1], bc[currentCodeIndex + 2]) : asUnsignedByte(bc[currentCodeIndex + 1])); } this.xaloadIndex = readLocalVariable(localVariableIndex); } else { this.xaloadIndex = null; } } else if (OP_IALOAD <= currentOpcode && currentOpcode <= OP_SALOAD) { //does nothing } else { this.xaloadIndex = null; } if (isInvoke(currentOpcode) || isReturn(currentOpcode)) { //no valid previous code index this.previousCodeIndex = -1; } else { this.previousCodeIndex = currentCodeIndex; } this.vm.resume(); final EventQueue queue = this.vm.eventQueue(); boolean stepFound = false; while (!stepFound) { try { final EventSet eventSet = queue.remove(); final EventIterator it = eventSet.eventIterator(); while (!stepFound && it.hasNext()) { final Event event = it.nextEvent(); if (event instanceof StepEvent) { this.currentStepEvent = (StepEvent) event; stepFound = true; } } if (!stepFound) { eventSet.resume(); } } catch (InterruptedException | VMDisconnectedException e) { throw new GuidanceException(e); } } sr.disable(); }
Example #14
Source File: Env.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
static void addExcludes(StepRequest request) { for (String pattern : excludes()) { request.addClassExclusionFilter(pattern); } }
Example #15
Source File: Env.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
static void addExcludes(StepRequest request) { for (String pattern : excludes()) { request.addClassExclusionFilter(pattern); } }
Example #16
Source File: Env.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
static void addExcludes(StepRequest request) { for (String pattern : excludes()) { request.addClassExclusionFilter(pattern); } }
Example #17
Source File: Env.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
static void addExcludes(StepRequest request) { for (String pattern : excludes()) { request.addClassExclusionFilter(pattern); } }
Example #18
Source File: Env.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
static void addExcludes(StepRequest request) { for (String pattern : excludes()) { request.addClassExclusionFilter(pattern); } }
Example #19
Source File: Env.java From hottub with GNU General Public License v2.0 | 4 votes |
static void addExcludes(StepRequest request) { for (String pattern : excludes()) { request.addClassExclusionFilter(pattern); } }
Example #20
Source File: Env.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
static void addExcludes(StepRequest request) { for (String pattern : excludes()) { request.addClassExclusionFilter(pattern); } }
Example #21
Source File: Env.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
static void addExcludes(StepRequest request) { for (String pattern : excludes()) { request.addClassExclusionFilter(pattern); } }
Example #22
Source File: Env.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
static void addExcludes(StepRequest request) { for (String pattern : excludes()) { request.addClassExclusionFilter(pattern); } }
Example #23
Source File: Env.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
static void addExcludes(StepRequest request) { for (String pattern : excludes()) { request.addClassExclusionFilter(pattern); } }
Example #24
Source File: Env.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
static void addExcludes(StepRequest request) { for (String pattern : excludes()) { request.addClassExclusionFilter(pattern); } }
Example #25
Source File: Env.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
static void addExcludes(StepRequest request) { for (String pattern : excludes()) { request.addClassExclusionFilter(pattern); } }
Example #26
Source File: StepActionProvider.java From netbeans with Apache License 2.0 | 4 votes |
public void runAction(final Object action) { runAction(getJDIAction(action), StepRequest.STEP_LINE, true, null, null, null); }
Example #27
Source File: StepIntoNextMethod.java From netbeans with Apache License 2.0 | 4 votes |
private StepRequest setStepRequest (int step) { return setStepRequest(step, StepRequest.STEP_LINE); }
Example #28
Source File: DebugUtility.java From java-debug with Eclipse Public License 1.0 | 2 votes |
/** * Create a step out request on the specified thread. * @param thread * the target thread. * @param stepFilters * the step filters when stepping. * @return the new step request. */ public static StepRequest createStepOutRequest(ThreadReference thread, String[] stepFilters) { return createStepOutRequest(thread, null, stepFilters); }
Example #29
Source File: DebugUtility.java From java-debug with Eclipse Public License 1.0 | 2 votes |
/** * Create a step out request on the specified thread. * @param thread * the target thread. * @param classFilters * restricts the step event to those matching the given class patterns when stepping. * @param classExclusionFilters * restricts the step event to those not matching the given class patterns when stepping. * @return the new step request. */ public static StepRequest createStepOutRequest(ThreadReference thread, String[] classFilters, String[] classExclusionFilters) { return createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_OUT, classFilters, classExclusionFilters); }
Example #30
Source File: DebugUtility.java From java-debug with Eclipse Public License 1.0 | 2 votes |
/** * Create a step into request on the specified thread. * @param thread * the target thread. * @param classFilters * restricts the step event to those matching the given class patterns when stepping. * @param classExclusionFilters * restricts the step event to those not matching the given class patterns when stepping. * @return the new step request. */ public static StepRequest createStepIntoRequest(ThreadReference thread, String[] classFilters, String[] classExclusionFilters) { return createStepRequest(thread, StepRequest.STEP_LINE, StepRequest.STEP_INTO, classFilters, classExclusionFilters); }