Java 类com.sun.jdi.request.StepRequest 实例源码

项目:incubator-netbeans    文件:JPDAStepImpl.java   
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);
    }
}
项目:incubator-netbeans    文件:JPDAStepImpl.java   
/**
 * 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;
}
项目:andbg    文件:step.java   
@Override
public void perform(String[] argv, Context ctx) {
    if (argv.length > 0) {
        switch (argv[0]) {
            case "into":
                singleStep(ctx, StepRequest.STEP_INTO);
                break;
            case "out":
                singleStep(ctx, StepRequest.STEP_OUT);
                break;
            case "over":
                singleStep(ctx, StepRequest.STEP_OVER);
                break;
            case "check":
                checkStep(ctx);
        }
    } else {
        singleStep(ctx, StepRequest.STEP_OVER);
    }
}
项目:intellij-ce-playground    文件:DebugProcessImpl.java   
void deleteStepRequests(@Nullable final ThreadReference stepThread) {
  EventRequestManager requestManager = getVirtualMachineProxy().eventRequestManager();
  List<StepRequest> stepRequests = requestManager.stepRequests();
  if (!stepRequests.isEmpty()) {
    final List<StepRequest> toDelete = new ArrayList<StepRequest>(stepRequests.size());
    for (final StepRequest request : stepRequests) {
      ThreadReference threadReference = request.thread();
      // [jeka] on attempt to delete a request assigned to a thread with unknown status, a JDWP error occurs
      try {
        if (threadReference.status() != ThreadReference.THREAD_STATUS_UNKNOWN && (stepThread == null || stepThread.equals(threadReference))) {
          toDelete.add(request);
        }
      }
      catch (IllegalThreadStateException e) {
        LOG.info(e); // undocumented by JDI: may be thrown when querying thread status
      }
      catch (ObjectCollectedException ignored) {
      }
    }
    requestManager.deleteEventRequests(toDelete);
  }
}
项目:intellij-ce-playground    文件:DebugProcessImpl.java   
@Override
public void contextAction() {
  showStatusText(DebuggerBundle.message("status.step.over"));
  final SuspendContextImpl suspendContext = getSuspendContext();
  final ThreadReferenceProxyImpl stepThread = getContextThread();
  // need this hint while stepping over for JSR45 support:
  // several lines of generated java code may correspond to a single line in the source file,
  // from which the java code was generated
  RequestHint hint = new RequestHint(stepThread, suspendContext, StepRequest.STEP_OVER);
  hint.setRestoreBreakpoints(myIsIgnoreBreakpoints);
  hint.setIgnoreFilters(myIsIgnoreBreakpoints || mySession.shouldIgnoreSteppingFilters());

  applyThreadFilter(stepThread);

  final MethodReturnValueWatcher rvWatcher = myReturnValueWatcher;
  if (rvWatcher != null) {
    rvWatcher.enable(stepThread.getThreadReference());
  }

  doStep(suspendContext, stepThread, myStepSize, StepRequest.STEP_OVER, hint);

  if (myIsIgnoreBreakpoints) {
    DebuggerManagerEx.getInstanceEx(myProject).getBreakpointManager().disableBreakpoints(DebugProcessImpl.this);
  }
  super.contextAction();
}
项目:che    文件:JavaDebugger.java   
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();
  }
}
项目:tools-idea    文件:DebugProcessImpl.java   
public void contextAction() {
  showStatusText(DebuggerBundle.message("status.step.into"));
  final SuspendContextImpl suspendContext = getSuspendContext();
  final ThreadReferenceProxyImpl stepThread = getContextThread();
  final RequestHint hint = mySmartStepFilter != null?
                           new RequestHint(stepThread, suspendContext, mySmartStepFilter) :
                           new RequestHint(stepThread, suspendContext, StepRequest.STEP_INTO);
  if (myForcedIgnoreFilters) {
    try {
      mySession.setIgnoreStepFiltersFlag(stepThread.frameCount());
    }
    catch (EvaluateException e) {
      LOG.info(e);
    }
  }
  hint.setIgnoreFilters(myForcedIgnoreFilters || mySession.shouldIgnoreSteppingFilters());
  applyThreadFilter(stepThread);
  doStep(suspendContext, stepThread, StepRequest.STEP_INTO, hint);
  super.contextAction();
}
项目:tools-idea    文件:DebugProcessImpl.java   
public void contextAction() {
  showStatusText(DebuggerBundle.message("status.step.over"));
  final SuspendContextImpl suspendContext = getSuspendContext();
  final ThreadReferenceProxyImpl stepThread = getContextThread();
  // need this hint whil stepping over for JSR45 support:
  // several lines of generated java code may correspond to a single line in the source file,
  // from which the java code was generated
  RequestHint hint = new RequestHint(stepThread, suspendContext, StepRequest.STEP_OVER);
  hint.setRestoreBreakpoints(myIsIgnoreBreakpoints);
  hint.setIgnoreFilters(myIsIgnoreBreakpoints || mySession.shouldIgnoreSteppingFilters());

  applyThreadFilter(stepThread);

  final MethodReturnValueWatcher rvWatcher = myReturnValueWatcher;
  if (rvWatcher != null) {
    rvWatcher.enable(stepThread.getThreadReference());
  }

  doStep(suspendContext, stepThread, StepRequest.STEP_OVER, hint);

  if (myIsIgnoreBreakpoints) {
    DebuggerManagerEx.getInstanceEx(myProject).getBreakpointManager().disableBreakpoints(DebugProcessImpl.this);
  }
  super.contextAction();
}
项目:jive    文件:JiveThread.java   
protected void createRequest()
{
  final EventRequestManager manager = getEventRequestManager();
  if (manager != null)
  {
    try
    {
      if (stepRequest != null)
      {
        removeRequest();
      }
      stepRequest = manager.createStepRequest(getUnderlyingThread(), StepRequest.STEP_LINE,
          StepRequest.STEP_INTO);
      final JiveDebugTarget target = (JiveDebugTarget) getDebugTarget();
      final IModelFilter requestFilter = target.jdiManager().modelFilter();
      requestFilter.filter(stepRequest);
      stepRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
      stepRequest.enable();
      addJDIEventListener(this, stepRequest);
    }
    catch (final RuntimeException e)
    {
      logError(e);
    }
  }
}
项目:freeVM    文件:Main.java   
final String run(String[] args) {
    if (jdb.status != Status.STARTED) {
        return String.format(NOT_VALID_UNTIL_STARTED, "stepi");
    }
    StepRequest request = 
        jdb.eventRequestManager.createStepRequest(jdb.thread, 
                StepRequest.STEP_MIN, 
                StepRequest.STEP_INTO);
    request.addCountFilter(1);// next step only
    request.enable();
    return "Step one instruction.";
}
项目:incubator-netbeans    文件:StepActionProvider.java   
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 ();
}
项目:incubator-netbeans    文件:StepIntoNextMethod.java   
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]);
    }
}
项目:incubator-netbeans    文件:Operator.java   
/**
 * 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);
    }
}
项目:incubator-netbeans    文件:JPDAStepImpl.java   
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;
}
项目:java-debug    文件:DebugUtility.java   
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;
}
项目:java-debug    文件:JavaHotCodeReplaceProvider.java   
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();
}
项目:intellij-ce-playground    文件:DebugProcessImpl.java   
@Override
public void contextAction() {
  showStatusText(DebuggerBundle.message("status.step.out"));
  final SuspendContextImpl suspendContext = getSuspendContext();
  final ThreadReferenceProxyImpl thread = getContextThread();
  RequestHint hint = new RequestHint(thread, suspendContext, StepRequest.STEP_OUT);
  hint.setIgnoreFilters(mySession.shouldIgnoreSteppingFilters());
  applyThreadFilter(thread);
  final MethodReturnValueWatcher rvWatcher = myReturnValueWatcher;
  if (rvWatcher != null) {
    rvWatcher.enable(thread.getThreadReference());
  }
  doStep(suspendContext, thread, myStepSize, StepRequest.STEP_OUT, hint);
  super.contextAction();
}
项目:intellij-ce-playground    文件:DebugProcessImpl.java   
@Override
public void contextAction() {
  showStatusText(DebuggerBundle.message("status.step.into"));
  final SuspendContextImpl suspendContext = getSuspendContext();
  final ThreadReferenceProxyImpl stepThread = getContextThread();
  final RequestHint hint = mySmartStepFilter != null?
                           new RequestHint(stepThread, suspendContext, mySmartStepFilter) :
                           new RequestHint(stepThread, suspendContext, StepRequest.STEP_INTO);
  hint.setResetIgnoreFilters(mySmartStepFilter != null && !mySession.shouldIgnoreSteppingFilters());
  if (myForcedIgnoreFilters) {
    try {
      mySession.setIgnoreStepFiltersFlag(stepThread.frameCount());
    }
    catch (EvaluateException e) {
      LOG.info(e);
    }
  }
  hint.setIgnoreFilters(myForcedIgnoreFilters || mySession.shouldIgnoreSteppingFilters());
  applyThreadFilter(stepThread);
  if (myBreakpoint != null) {
    myBreakpoint.setSuspendPolicy(suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD? DebuggerSettings.SUSPEND_THREAD : DebuggerSettings.SUSPEND_ALL);
    myBreakpoint.createRequest(suspendContext.getDebugProcess());
    setRunToCursorBreakpoint(myBreakpoint);
  }
  doStep(suspendContext, stepThread, myStepSize, StepRequest.STEP_INTO, hint);
  super.contextAction();
}
项目:che    文件:JavaDebugger.java   
private void clearSteps() throws DebuggerException {
  List<StepRequest> snapshot = new ArrayList<>(getEventManager().stepRequests());
  for (StepRequest stepRequest : snapshot) {
    if (stepRequest.thread().equals(getCurrentThread())) {
      getEventManager().deleteEventRequest(stepRequest);
    }
  }
}
项目:form-follows-function    文件:F3EventRequest.java   
public static List<StepRequest> wrapStepRequests(
        F3VirtualMachine f3vm, List<StepRequest> reqs) {
    if (reqs == null) {
        return null;
    }
    List<StepRequest> result = new ArrayList<StepRequest>();
    for (StepRequest req : reqs) {
        result.add(wrap(f3vm, req));
    }
    return result;
}
项目: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 boolean next() {
    StepRequest req = evaluator.commandNext(false);
    if (req != null) {
        resumeToEvent(req);
        return true;
    } else {
        return false;
    }
}
项目:form-follows-function    文件:Debugger.java   
public boolean step(String command) {
    StepRequest req = evaluator.commandStep(new StringTokenizer(command), false);
    if (req != null) {
        resumeToEvent(req);
        return true;
    } else {
        return false;
    }
}
项目:form-follows-function    文件:Debugger.java   
public boolean stepi() {
    StepRequest req = evaluator.commandStepi(false);
    if (req != null) {
        resumeToEvent(req);
        return true;
    } else {
        return false;
    }
}
项目:cn1    文件:Main.java   
final String run(String[] args) {
    if (jdb.status != Status.STARTED) {
        return String.format(NOT_VALID_UNTIL_STARTED, "step");
    }
    StepRequest request = 
        jdb.eventRequestManager.createStepRequest(jdb.thread, 
                StepRequest.STEP_LINE, 
                StepRequest.STEP_INTO);
    request.addCountFilter(1);// next step only
    request.enable();
    return "Step one line.";
}
项目:cn1    文件:Main.java   
final String run(String[] args) {
    if (jdb.status != Status.STARTED) {
        return String.format(NOT_VALID_UNTIL_STARTED, "stepi");
    }
    StepRequest request = 
        jdb.eventRequestManager.createStepRequest(jdb.thread, 
                StepRequest.STEP_MIN, 
                StepRequest.STEP_INTO);
    request.addCountFilter(1);// next step only
    request.enable();
    return "Step one instruction.";
}
项目:cn1    文件:Main.java   
final String run(String[] args) {
    if (jdb.status != Status.STARTED) {
        return String.format(NOT_VALID_UNTIL_STARTED, "next");
    }
    StepRequest request = 
        jdb.eventRequestManager.createStepRequest(jdb.thread, 
                StepRequest.STEP_LINE, 
                StepRequest.STEP_OVER);
    request.addCountFilter(1);// next step only
    request.enable();
    return "Step one line (over calls)";
}
项目:tools-idea    文件:DebugProcessImpl.java   
void deleteStepRequests(@Nullable final ThreadReference stepThread) {
  EventRequestManager requestManager = getVirtualMachineProxy().eventRequestManager();
  List<StepRequest> stepRequests = requestManager.stepRequests();
  if (!stepRequests.isEmpty()) {
    final List<StepRequest> toDelete = new ArrayList<StepRequest>(stepRequests.size());
    for (final StepRequest request : stepRequests) {
      ThreadReference threadReference = request.thread();
      // [jeka] on attempt to delete a request assigned to a thread with unknown status, a JDWP error occures
      if (threadReference.status() != ThreadReference.THREAD_STATUS_UNKNOWN && (stepThread == null || stepThread.equals(threadReference))) {
        toDelete.add(request);
      }
    }
    requestManager.deleteEventRequests(toDelete);
  }
}
项目:tools-idea    文件:DebugProcessImpl.java   
public void contextAction() {
  showStatusText(DebuggerBundle.message("status.step.out"));
  final SuspendContextImpl suspendContext = getSuspendContext();
  final ThreadReferenceProxyImpl thread = getContextThread();
  RequestHint hint = new RequestHint(thread, suspendContext, StepRequest.STEP_OUT);
  hint.setIgnoreFilters(mySession.shouldIgnoreSteppingFilters());
  applyThreadFilter(thread);
  final MethodReturnValueWatcher rvWatcher = myReturnValueWatcher;
  if (rvWatcher != null) {
    rvWatcher.enable(thread.getThreadReference());
  }
  doStep(suspendContext, thread, StepRequest.STEP_OUT, hint);
  super.contextAction();
}
项目: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;
}
项目:freeVM    文件:Main.java   
final String run(String[] args) {
    if (jdb.status != Status.STARTED) {
        return String.format(NOT_VALID_UNTIL_STARTED, "step");
    }
    StepRequest request = 
        jdb.eventRequestManager.createStepRequest(jdb.thread, 
                StepRequest.STEP_LINE, 
                StepRequest.STEP_INTO);
    request.addCountFilter(1);// next step only
    request.enable();
    return "Step one line.";
}
项目:freeVM    文件:Main.java   
final String run(String[] args) {
    if (jdb.status != Status.STARTED) {
        return String.format(NOT_VALID_UNTIL_STARTED, "next");
    }
    StepRequest request = 
        jdb.eventRequestManager.createStepRequest(jdb.thread, 
                StepRequest.STEP_LINE, 
                StepRequest.STEP_OVER);
    request.addCountFilter(1);// next step only
    request.enable();
    return "Step one line (over calls)";
}
项目:JavaTracer    文件:ThreadTrace.java   
public ThreadTrace(ThreadReference thread, VirtualMachine vm) {
    this.thread = thread;
    this.vm=vm;
    EventRequestManager mgr = vm.eventRequestManager();
    StepRequest request = mgr.createStepRequest(this.thread, StepRequest.STEP_LINE, StepRequest.STEP_OVER);
    request.setSuspendPolicy(EventRequest.SUSPEND_ALL);
    request.addCountFilter(1);
    request.enable();
}
项目:incubator-netbeans    文件:StepActionProvider.java   
public void runAction(final Object action) {
    runAction(getJDIAction(action), StepRequest.STEP_LINE, true, null, null, null);
}
项目:incubator-netbeans    文件:StepIntoNextMethod.java   
private StepRequest setStepRequest (int step) {
    return setStepRequest(step, StepRequest.STEP_LINE);
}
项目:incubator-netbeans    文件:StepIntoNextMethod.java   
private StepRequest setStepRequest (int step, JPDAThreadImpl[] resumeThreadPtr) {
    return setStepRequest(step, StepRequest.STEP_LINE, resumeThreadPtr);
}
项目:OpenJSharp    文件:Env.java   
static void addExcludes(StepRequest request) {
    for (String pattern : excludes()) {
        request.addClassExclusionFilter(pattern);
    }
}
项目:jdk8u-jdk    文件:Env.java   
static void addExcludes(StepRequest request) {
    for (String pattern : excludes()) {
        request.addClassExclusionFilter(pattern);
    }
}
项目:openjdk-jdk10    文件:Env.java   
static void addExcludes(StepRequest request) {
    for (String pattern : excludes()) {
        request.addClassExclusionFilter(pattern);
    }
}
项目:openjdk-jdk10    文件:EventRequestManagerImpl.java   
StepRequestImpl(ThreadReference thread, int size, int depth) {
    this.thread = (ThreadReferenceImpl)thread;
    this.size = size;
    this.depth = depth;

    /*
     * Translate size and depth to corresponding JDWP values.
     */
    int jdwpSize;
    switch (size) {
        case STEP_MIN:
            jdwpSize = JDWP.StepSize.MIN;
            break;
        case STEP_LINE:
            jdwpSize = JDWP.StepSize.LINE;
            break;
        default:
            throw new IllegalArgumentException("Invalid step size");
    }

    int jdwpDepth;
    switch (depth) {
        case STEP_INTO:
            jdwpDepth = JDWP.StepDepth.INTO;
            break;
        case STEP_OVER:
            jdwpDepth = JDWP.StepDepth.OVER;
            break;
        case STEP_OUT:
            jdwpDepth = JDWP.StepDepth.OUT;
            break;
        default:
            throw new IllegalArgumentException("Invalid step depth");
    }

    /*
     * Make sure this isn't a duplicate
     */
    List<StepRequest> requests = stepRequests();
    Iterator<StepRequest> iter = requests.iterator();
    while (iter.hasNext()) {
        StepRequest request = iter.next();
        if ((request != this) &&
                request.isEnabled() &&
                request.thread().equals(thread)) {
            throw new DuplicateRequestException(
                "Only one step request allowed per thread");
        }
    }

    filters.add(JDWP.EventRequest.Set.Modifier.Step.
                create(this.thread, jdwpSize, jdwpDepth));
    requestList().add(this);

}