Java 类com.sun.jdi.event.StepEvent 实例源码

项目:andbg    文件:step.java   
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");
    }
}
项目:form-follows-function    文件:F3Event.java   
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);
    }
}
项目:jive    文件:JDIEventHandler.java   
@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);
  }
}
项目:jive    文件:ModelFilter.java   
/**
 * 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;
}
项目:jive    文件:EventHandlerLite.java   
@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;
}
项目:andbg    文件:Simplify.java   
@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());
    }
}
项目:andbg    文件:MethodTracer.java   
@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");
            }
        }
项目:form-follows-function    文件:Debugger.java   
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;
}
项目:form-follows-function    文件:Debugger.java   
public StepEvent resumeToStep() {
    return (StepEvent) resumeToEvent(new EventFilter() {
        public boolean match(Event evt) {
            return (evt instanceof StepEvent);
        }
    });
}
项目:form-follows-function    文件:Debugger.java   
public void stepEvent(StepEvent evt) {
    synchronized (listeners) {
        for (EventNotifier en : listeners) {
            en.stepEvent(evt);
        }
    }
}
项目:jive    文件:JiveThread.java   
@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;
}
项目:jive    文件:JDIEventHandlerDelegate.java   
/**
 * 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);
}
项目:java-debug    文件:EventHub.java   
/**
 * 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);
}
项目:form-follows-function    文件:F3StepEvent.java   
public F3StepEvent(F3VirtualMachine f3vm, StepEvent underlying) {
    super(f3vm, underlying);
}
项目:form-follows-function    文件:F3StepEvent.java   
@Override
protected StepEvent underlying() {
    return (StepEvent) super.underlying();
}
项目:form-follows-function    文件:Debugger.java   
public StepEvent stepIntoInstruction(ThreadReference thread) {
    return doStep(thread, StepRequest.STEP_MIN, StepRequest.STEP_INTO);
}
项目:form-follows-function    文件:Debugger.java   
public StepEvent stepIntoInstruction() {
    return stepIntoInstruction(getCurrentThread());
}
项目:form-follows-function    文件:Debugger.java   
public StepEvent stepIntoLine(ThreadReference thread) {
    return doStep(thread, StepRequest.STEP_LINE, StepRequest.STEP_INTO);
}
项目:form-follows-function    文件:Debugger.java   
public StepEvent stepIntoLine() {
    return stepIntoLine(getCurrentThread());
}
项目:form-follows-function    文件:Debugger.java   
public StepEvent stepOverInstruction(ThreadReference thread) {
    return doStep(thread, StepRequest.STEP_MIN, StepRequest.STEP_OVER);
}
项目:form-follows-function    文件:Debugger.java   
public StepEvent stepOverInstruction() {
    return stepOverInstruction(getCurrentThread());
}
项目:form-follows-function    文件:Debugger.java   
public StepEvent stepOverLine(ThreadReference thread) {
    return doStep(thread, StepRequest.STEP_LINE, StepRequest.STEP_OVER);
}
项目:form-follows-function    文件:Debugger.java   
public StepEvent stepOverLine() {
    return stepOverLine(getCurrentThread());
}
项目:form-follows-function    文件:Debugger.java   
public StepEvent stepOut(ThreadReference thread) {
    return doStep(thread, StepRequest.STEP_LINE, StepRequest.STEP_OUT);
}
项目:form-follows-function    文件:Debugger.java   
public StepEvent stepOut() {
    return stepOut(getCurrentThread());
}
项目:form-follows-function    文件:EventNotifierAdapter.java   
public void stepEvent(StepEvent e) {
}
项目:jdivisitor    文件:VisitableStepEvent.java   
public VisitableStepEvent(StepEvent event) {
    this.event = event;
}
项目:jdivisitor    文件:EmptyEventVisitor.java   
@Override
public void visit(StepEvent event) {
}
项目:jdivisitor    文件:EventVisitor.java   
/**
 * Visit a {@code StepEvent}.
 *
 * @param event Event to visit
 */
void visit(StepEvent event);
项目:jive    文件:IJDIEventHandler.java   
/**
 * 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);
项目:jive    文件:IModelFilter.java   
/**
 * Check if this filter accepts the step event
 */
public boolean acceptsStep(StepEvent event);
项目:andbg    文件:MethodTracer.java   
void step(StepEvent event);