private void singleStep(final Context ctx, int depth) { if (ctx.getState().isSuspend()) { ctx.registerStep(ctx.getState().thread, depth, 1, new EventCallback() { @Override public void handleEvent(Event event) { StepEvent se = (StepEvent) event; SuspendState state = ctx.getState(); state.isSuspend = true; state.thread = se.thread(); state.location = se.location(); util.Logger("single step complete"); } }); ctx.getState().resume(); } else { System.err.println("suspend thread before step"); } }
public static F3Event wrap(F3VirtualMachine f3vm, Event evt) { if (evt == null) { return null; } if (evt instanceof AccessWatchpointEvent) { return new F3AccessWatchpointEvent(f3vm, (AccessWatchpointEvent)evt); } else if (evt instanceof BreakpointEvent) { return new F3BreakpointEvent(f3vm, (BreakpointEvent)evt); } else if (evt instanceof ClassPrepareEvent) { return new F3ClassPrepareEvent(f3vm, (ClassPrepareEvent)evt); } else if (evt instanceof ClassUnloadEvent) { return new F3ClassUnloadEvent(f3vm, (ClassUnloadEvent)evt); } else if (evt instanceof ExceptionEvent) { return new F3ExceptionEvent(f3vm, (ExceptionEvent)evt); } else if (evt instanceof MethodEntryEvent) { return new F3MethodEntryEvent(f3vm, (MethodEntryEvent)evt); } else if (evt instanceof MethodExitEvent) { return new F3MethodExitEvent(f3vm, (MethodExitEvent)evt); } else if (evt instanceof ModificationWatchpointEvent) { return new F3ModificationWatchpointEvent(f3vm, (ModificationWatchpointEvent)evt); } else if (evt instanceof MonitorContendedEnterEvent) { return new F3MonitorContendedEnterEvent(f3vm, (MonitorContendedEnterEvent)evt); } else if (evt instanceof MonitorContendedEnteredEvent) { return new F3MonitorContendedEnteredEvent(f3vm, (MonitorContendedEnteredEvent)evt); } else if (evt instanceof MonitorWaitEvent) { return new F3MonitorWaitEvent(f3vm, (MonitorWaitEvent)evt); } else if (evt instanceof MonitorWaitedEvent) { return new F3MonitorWaitedEvent(f3vm, (MonitorWaitedEvent)evt); } else if (evt instanceof StepEvent) { return new F3StepEvent(f3vm, (StepEvent)evt); } else if (evt instanceof ThreadDeathEvent) { return new F3ThreadDeathEvent(f3vm, (ThreadDeathEvent)evt); } else if (evt instanceof ThreadStartEvent) { return new F3ThreadStartEvent(f3vm, (ThreadStartEvent)evt); } else if (evt instanceof VMDeathEvent) { return new F3VMDeathEvent(f3vm, (VMDeathEvent)evt); } else if (evt instanceof VMDisconnectEvent) { return new F3VMDisconnectEvent(f3vm, (VMDisconnectEvent)evt); } else if (evt instanceof VMStartEvent) { return new F3VMStartEvent(f3vm, (VMStartEvent)evt); } else if (evt instanceof WatchpointEvent) { return new F3WatchpointEvent(f3vm, (WatchpointEvent)evt); } else if (evt instanceof LocatableEvent) { return new F3LocatableEvent(f3vm, (LocatableEvent)evt); } else { return new F3Event(f3vm, evt); } }
@Override public void jdiStep(final StepEvent event) { if (!override && !owner.isStarted()) { return; } try { delegate.handleStep(event, manager().generateLocalEvents()); // if (manager().generateLockEvents()) { // inspectThreads(); // } } catch (final Throwable e) { JiveDebugPlugin.log(e); } }
/** * Step events are filtered according to accepted types and methods. */ @Override public boolean acceptsStep(final StepEvent event) { if (!acceptsLocation(event.location())) { return false; } ObjectReference oref; try { oref = event.thread().frame(0).thisObject(); } catch (final IncompatibleThreadStateException e) { oref = null; } // step's context type if (oref != null && !acceptsType(oref.referenceType())) { return false; } return true; }
@Override public void jdiStep(final StepEvent event) { final Method method = event.location().method(); if (method.isSynthetic() || method.isBridge() || method.name().contains("$")) { return; } // this.currentEvent = event; this.currentThread = event.thread(); // final long[] eventId = registry.encode(EventHandlerLite.KIND_LINE_STEP); // System.out.format(EventHandlerLite.ENCODED_LINE_STEP, eventId[0], eventId[1]); // System.out.println(registry.decode(eventId)); // this.currentEvent = null; this.currentThread = null; }
@Override public void step(StepEvent event) { MethodEntity entity = new MethodEntity(); com.sun.jdi.Method method = event.location().method(); entity.setClassName(method.declaringType().signature()); entity.setMethodName(method.name()); entity.setDescription(method.signature()); MethodTracer tracer = simplify.getTracerMap().get(entity); if (tracer != null) { parse(tracer, event.thread(), event.location()); } }
@Override public void handleEvent(Event event) { StepEvent se = (StepEvent)event; // long index = se.location().codeIndex(); // System.out.println("index: " + index); if (listener != null) { listener.step(se); } if (se.thread().isSuspended()) se.thread().resume(); else { util.Logger("[Method Step]thread is not suspend"); } }
private StepEvent doStep(ThreadReference thread, int gran, int depth) { final StepRequest sr = eventRequestManager().createStepRequest(thread, gran, depth); sr.addClassExclusionFilter("java.*"); sr.addClassExclusionFilter("sun.*"); sr.addClassExclusionFilter("com.sun.*"); sr.addCountFilter(1); sr.enable(); StepEvent retEvent = (StepEvent)resumeToEvent(sr); eventRequestManager().deleteEventRequest(sr); return retEvent; }
public StepEvent resumeToStep() { return (StepEvent) resumeToEvent(new EventFilter() { public boolean match(Event evt) { return (evt instanceof StepEvent); } }); }
public void stepEvent(StepEvent evt) { synchronized (listeners) { for (EventNotifier en : listeners) { en.stepEvent(evt); } } }
@Override public boolean handleEvent(final Event event, final JDIDebugTarget target, final boolean suspendVote, final EventSet eventSet) { final StepEvent stepEvent = (StepEvent) event; if (isActive()) { jdiHandler.jdiStep(stepEvent); } boolean result = true; final JDTStepHandler stepHandler = getPendingStepHandler(); if (stepHandler != null) { switch (stepHandler.getStepKind()) { case StepRequest.STEP_INTO: if (shouldHandleStepInto(stepEvent.location())) { result = stepHandler.handleEvent(event, target, suspendVote, eventSet); } break; case StepRequest.STEP_OVER: if (shouldHandleStepOver(stepEvent.location())) { result = stepHandler.handleEvent(event, target, suspendVote, eventSet); } break; case StepRequest.STEP_OUT: if (shouldHandleStepReturn(stepEvent.location())) { result = stepHandler.handleEvent(event, target, suspendVote, eventSet); } break; default: // TODO log error break; } } return result; }
/** * No steps from filtered methods. */ void handleStep(final StepEvent event, final boolean generateLocals) throws IncompatibleThreadStateException, AbsentInformationException { if (!eventFilter().acceptsStep(event)) { return; } // adjust the stack frames if necessary final StackFrame frame = determineStackFrame(event); // no support for out-of-model step events if (!eventFilter().acceptsMethod(frame.location().method(), frame.thread())) { return; } // handle a pending array result if (manager().generateArrayEvents() && executionState().lookupArrayResult(frame.thread()) != null) { processArrayCellWrite(event.location(), frame, executionState().lookupArrayResult(frame.thread())); executionState().removeArrayResult(frame.thread()); } // handle a pending returned event if necessary final boolean withPendingReturn = handlePendingReturned(event.location(), frame, event.thread()); // handle locals if necessary-- a write is inferred *after* it has been performed if (generateLocals && !withPendingReturn) { /** * if a pending return was processed, VarAssign/VarDelete events should rely on the locatable * event for their source location. */ handleLocals(withPendingReturn ? event : null, frame, event.location()); } // record the step dispatcher().dispatchStepEvent(event.location(), frame); }
/** * Gets the observable object for step events. * @return the observable object for step events */ @Override public Observable<DebugEvent> stepEvents() { return this.events().filter(debugEvent -> debugEvent.event instanceof StepEvent); }
public F3StepEvent(F3VirtualMachine f3vm, StepEvent underlying) { super(f3vm, underlying); }
@Override protected StepEvent underlying() { return (StepEvent) super.underlying(); }
public StepEvent stepIntoInstruction(ThreadReference thread) { return doStep(thread, StepRequest.STEP_MIN, StepRequest.STEP_INTO); }
public StepEvent stepIntoInstruction() { return stepIntoInstruction(getCurrentThread()); }
public StepEvent stepIntoLine(ThreadReference thread) { return doStep(thread, StepRequest.STEP_LINE, StepRequest.STEP_INTO); }
public StepEvent stepIntoLine() { return stepIntoLine(getCurrentThread()); }
public StepEvent stepOverInstruction(ThreadReference thread) { return doStep(thread, StepRequest.STEP_MIN, StepRequest.STEP_OVER); }
public StepEvent stepOverInstruction() { return stepOverInstruction(getCurrentThread()); }
public StepEvent stepOverLine(ThreadReference thread) { return doStep(thread, StepRequest.STEP_LINE, StepRequest.STEP_OVER); }
public StepEvent stepOverLine() { return stepOverLine(getCurrentThread()); }
public StepEvent stepOut(ThreadReference thread) { return doStep(thread, StepRequest.STEP_LINE, StepRequest.STEP_OUT); }
public StepEvent stepOut() { return stepOut(getCurrentThread()); }
public void stepEvent(StepEvent e) { }
public VisitableStepEvent(StepEvent event) { this.event = event; }
@Override public void visit(StepEvent event) { }
/** * Visit a {@code StepEvent}. * * @param event Event to visit */ void visit(StepEvent event);
/** * A step event is generated immediately before the code at its location is executed; thus, if the * step is entering a new method (as might occur with StepRequest.STEP_INTO) the location of the * event is the first instruction of the method. When a step leaves a method, the location of the * event will be the first instruction after the call in the calling method; note that this * location may not be at a line boundary, even if StepRequest.STEP_LINE was used. */ void jdiStep(StepEvent event);
/** * Check if this filter accepts the step event */ public boolean acceptsStep(StepEvent event);
void step(StepEvent event);