本文整理汇总了Java中com.sun.jdi.request.StepRequest类的典型用法代码示例。如果您正苦于以下问题:Java StepRequest类的具体用法?Java StepRequest怎么用?Java StepRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StepRequest类属于com.sun.jdi.request包,在下文中一共展示了StepRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stepDone
import com.sun.jdi.request.StepRequest; //导入依赖的package包/类
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);
}
}
示例2: isSyntheticMethod
import com.sun.jdi.request.StepRequest; //导入依赖的package包/类
/**
* 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;
}
示例3: perform
import com.sun.jdi.request.StepRequest; //导入依赖的package包/类
@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);
}
}
示例4: deleteStepRequests
import com.sun.jdi.request.StepRequest; //导入依赖的package包/类
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);
}
}
示例5: contextAction
import com.sun.jdi.request.StepRequest; //导入依赖的package包/类
@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();
}
示例6: doStep
import com.sun.jdi.request.StepRequest; //导入依赖的package包/类
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();
}
}
示例7: contextAction
import com.sun.jdi.request.StepRequest; //导入依赖的package包/类
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();
}
示例8: createRequest
import com.sun.jdi.request.StepRequest; //导入依赖的package包/类
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);
}
}
}
示例9: run
import com.sun.jdi.request.StepRequest; //导入依赖的package包/类
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.";
}
示例10: getJDIAction
import com.sun.jdi.request.StepRequest; //导入依赖的package包/类
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 ();
}
示例11: addPatternsToRequest
import com.sun.jdi.request.StepRequest; //导入依赖的package包/类
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]);
}
}
示例12: unregister
import com.sun.jdi.request.StepRequest; //导入依赖的package包/类
/**
* 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);
}
}
示例13: setUpBoundaryStepRequest
import com.sun.jdi.request.StepRequest; //导入依赖的package包/类
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;
}
示例14: createStepRequest
import com.sun.jdi.request.StepRequest; //导入依赖的package包/类
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;
}
示例15: stepIntoThread
import com.sun.jdi.request.StepRequest; //导入依赖的package包/类
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();
}