当前位置: 首页>>代码示例>>Java>>正文


Java EventRequest类代码示例

本文整理汇总了Java中com.sun.jdi.request.EventRequest的典型用法代码示例。如果您正苦于以下问题:Java EventRequest类的具体用法?Java EventRequest怎么用?Java EventRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EventRequest类属于com.sun.jdi.request包,在下文中一共展示了EventRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initSourceBreakpoints

import com.sun.jdi.request.EventRequest; //导入依赖的package包/类
private void initSourceBreakpoints() {
    synchronized (sourceBreakpointsInitLock) {
        if (scriptBP == null) {
            scriptBP = ClassLoadUnloadBreakpoint.create(JSUtils.NASHORN_SCRIPT+"*",
                                                        false,
                                                        ClassLoadUnloadBreakpoint.TYPE_CLASS_LOADED);
            scriptBP.setHidden(true);
            scriptBP.setSuspend(EventRequest.SUSPEND_NONE);

            sourceBindBP = MethodBreakpoint.create(NASHORN_CONTEXT_CLASS, NASHORN_CONTEXT_SOURCE_BIND_METHOD);
            sourceBindBP.setHidden(true);
            sourceBindBP.setSuspend(EventRequest.SUSPEND_EVENT_THREAD);
            
            functionClassBP = MethodBreakpoint.create(NASHORN_FUNCTION_NODE_CLASS, NASHORN_FUNCTION_NODE_SET_CLASS);
            functionClassBP.setHidden(true);
            functionClassBP.setSuspend(EventRequest.SUSPEND_EVENT_THREAD);
            
            debuggerBP = MethodBreakpoint.create(NASHORN_SCRIPT_RUNTIME_CLASS, NASHORN_SCRIPT_RUNTIME_DEBUGGER_METHOD);
            debuggerBP.setHidden(true);
            debuggerBP.setSuspend(EventRequest.SUSPEND_EVENT_THREAD);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:JSJavaBreakpointsManager.java

示例2: createOperator

import com.sun.jdi.request.EventRequest; //导入依赖的package包/类
private Operator createOperator (
    VirtualMachine virtualMachine,
    final Object startLock
) {
    return new Operator (
        virtualMachine,
        debuggerImpl,
        new Executor () {
            @Override
            public boolean exec(Event event) {
                synchronized(startLock) {
                    startLock.notify();
                }
                return false;
            }

            @Override
            public void removed(EventRequest eventRequest) {}
            
        },
        new Runnable () {
            @Override
            public void run () {
                debuggerImpl.finish();
            }
        },
        debuggerImpl.accessLock
    );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:StartActionProvider.java

示例3: stepDone

import com.sun.jdi.request.EventRequest; //导入依赖的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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:JPDAStepImpl.java

示例4: resolve

import com.sun.jdi.request.EventRequest; //导入依赖的package包/类
/**
 * Resolve all deferred eventRequests waiting for 'refType'.
 * @return true if it completes successfully, false on error.
 */
boolean resolve(ClassPrepareEvent event) {
    boolean failure = false;
    synchronized(eventRequestSpecs) {
        for (EventRequestSpec spec : eventRequestSpecs) {
            if (!spec.isResolved()) {
                try {
                    EventRequest eventRequest = spec.resolve(event);
                    if (eventRequest != null) {
                        MessageOutput.println("Set deferred", spec.toString());
                    }
                } catch (Exception e) {
                    MessageOutput.println("Unable to set deferred",
                                          new Object [] {spec.toString(),
                                                         spec.errorMessageFor(e)});
                    failure = true;
                }
            }
        }
    }
    return !failure;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:EventRequestSpecList.java

示例5: ExceptionRequestImpl

import com.sun.jdi.request.EventRequest; //导入依赖的package包/类
ExceptionRequestImpl(ReferenceType refType,
                  boolean notifyCaught, boolean notifyUncaught) {
    exception = refType;
    caught = notifyCaught;
    uncaught = notifyUncaught;
    {
        ReferenceTypeImpl exc;
        if (exception == null) {
            exc = new ClassTypeImpl(vm, 0);
        } else {
            exc = (ReferenceTypeImpl)exception;
        }
        filters.add(JDWP.EventRequest.Set.Modifier.ExceptionOnly.
                    create(exc, caught, uncaught));
    }
    requestList().add(this);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:EventRequestManagerImpl.java

示例6: resume

import com.sun.jdi.request.EventRequest; //导入依赖的package包/类
public void resume() {
    switch (suspendPolicy()) {
        case EventRequest.SUSPEND_ALL:
            vm.resume();
            break;
        case EventRequest.SUSPEND_EVENT_THREAD:
            ThreadReference thread = eventThread();
            if (thread == null) {
                throw new InternalException("Inconsistent suspend policy");
            }
            thread.resume();
            break;
        case EventRequest.SUSPEND_NONE:
            // Do nothing
            break;
        default:
            throw new InternalException("Invalid suspend policy");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:EventSetImpl.java

示例7: stopOnEntry

import com.sun.jdi.request.EventRequest; //导入依赖的package包/类
/**
 * Suspend the main thread when the program enters the main method of the specified main class.
 * @param debugSession
 *                  the debug session.
 * @param mainClass
 *                  the fully qualified name of the main class.
 * @return
 *        a {@link CompletableFuture} that contains the suspended main thread id.
 */
public static CompletableFuture<Long> stopOnEntry(IDebugSession debugSession, String mainClass) {
    CompletableFuture<Long> future = new CompletableFuture<>();

    EventRequestManager manager = debugSession.getVM().eventRequestManager();
    MethodEntryRequest request = manager.createMethodEntryRequest();
    request.addClassFilter(mainClass);
    request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);

    debugSession.getEventHub().events().filter(debugEvent -> {
        return debugEvent.event instanceof MethodEntryEvent && request.equals(debugEvent.event.request());
    }).subscribe(debugEvent -> {
        Method method = ((MethodEntryEvent) debugEvent.event).method();
        if (method.isPublic() && method.isStatic() && method.name().equals("main")
                && method.signature().equals("([Ljava/lang/String;)V")) {
            deleteEventRequestSafely(debugSession.getVM().eventRequestManager(), request);
            debugEvent.shouldResume = false;
            ThreadReference bpThread = ((MethodEntryEvent) debugEvent.event).thread();
            future.complete(bpThread.uniqueID());
        }
    });
    request.enable();

    return future;
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:34,代码来源:DebugUtility.java

示例8: perform

import com.sun.jdi.request.EventRequest; //导入依赖的package包/类
@Override
    public void perform(String[] argv, Context ctx) {

        EventRequestManager manager = ctx.getVm().eventRequestManager();
        MethodEntryRequest mer = manager.createMethodEntryRequest();
        mer.setSuspendPolicy(EventRequest.SUSPEND_NONE);
        mer.enable();

        ctx.register(mer, new EventCallback() {
            @Override
            public void handleEvent(Event event) {
                MethodEntryEvent mee = (MethodEntryEvent) event;
                Method method = mee.method();
                System.out.println("--" + method.name());
//                mee.thread().resume();
            }
        });
    }
 
开发者ID:CvvT,项目名称:andbg,代码行数:19,代码来源:track.java

示例9: onReached

import com.sun.jdi.request.EventRequest; //导入依赖的package包/类
@Override
public int onReached(SuspendContextImpl context) {
  StackFrameProxyImpl proxy = context.getFrameProxy();
  if (proxy != null) {
    try {
      ObjectReference reference = proxy.thisObject();
      if (reference != null) {
        DebugProcessImpl debugProcess = context.getDebugProcessNoAssert();
        BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(debugProcess.getProject()).getBreakpointManager();
        StepIntoBreakpoint breakpoint = breakpointManager.addStepIntoBreakpoint(myMethodFilter);
        if (breakpoint != null) {
          breakpointManager.applyThreadFilter(debugProcess, null); // clear the filter on resume
          breakpoint.addInstanceFilter(reference.uniqueID());
          breakpoint.setInstanceFiltersEnabled(true);
          breakpoint.setSuspendPolicy(context.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD ? DebuggerSettings.SUSPEND_THREAD : DebuggerSettings.SUSPEND_ALL);
          breakpoint.createRequest(debugProcess);
          debugProcess.setRunToCursorBreakpoint(breakpoint);
          return RequestHint.RESUME;
        }
      }
    }
    catch (EvaluateException ignored) {
    }
  }
  return RequestHint.STOP;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ClassInstanceMethodFilter.java

示例10: resumeAction

import com.sun.jdi.request.EventRequest; //导入依赖的package包/类
@Override
protected void resumeAction() {
  SuspendContextImpl context = getSuspendContext();
  if (context != null && context.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD) {
    myThreadBlockedMonitor.startWatching(myContextThread);
  }
  if (context != null
      && Registry.is("debugger.step.resumes.one.thread")
      && context.getSuspendPolicy() == EventRequest.SUSPEND_ALL
      && myContextThread != null) {
    getSuspendManager().resumeThread(context, myContextThread);
  }
  else {
    super.resumeAction();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:DebugProcessImpl.java

示例11: resolve

import com.sun.jdi.request.EventRequest; //导入依赖的package包/类
/**
 * Resolve all deferred eventRequests waiting for 'refType'.
 * @return true if it completes successfully, false on error.
 */
boolean resolve(ClassPrepareEvent event) {
    boolean failure = false;
    synchronized(eventRequestSpecs) {
        for (EventRequestSpec spec : eventRequestSpecs) {
            if (!spec.isResolved()) {
                try {
                    EventRequest eventRequest = spec.resolve(event);
                    if (eventRequest != null) {
                        env.messageOutput().println("Set deferred", spec.toString());
                    }
                } catch (Exception e) {
                    env.messageOutput().println("Unable to set deferred",
                                          new Object [] {spec.toString(),
                                                         spec.errorMessageFor(e)});
                    failure = true;
                }
            }
        }
    }
    return !failure;
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:26,代码来源:EventRequestSpecList.java

示例12: contextAction

import com.sun.jdi.request.EventRequest; //导入依赖的package包/类
public void contextAction() {
  showStatusText(DebuggerBundle.message("status.run.to.cursor"));
  cancelRunToCursorBreakpoint();
  if (myRunToCursorBreakpoint == null) {
    return;
  }
  if (myIgnoreBreakpoints) {
    final BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(myProject).getBreakpointManager();
    breakpointManager.disableBreakpoints(DebugProcessImpl.this);
  }
  applyThreadFilter(getContextThread());
  final SuspendContextImpl context = getSuspendContext();
  myRunToCursorBreakpoint.SUSPEND_POLICY = context.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD? DebuggerSettings.SUSPEND_THREAD : DebuggerSettings.SUSPEND_ALL;
  myRunToCursorBreakpoint.LOG_ENABLED = false;
  myRunToCursorBreakpoint.createRequest(context.getDebugProcess());
  DebugProcessImpl.this.myRunToCursorBreakpoint = myRunToCursorBreakpoint;
  super.contextAction();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:DebugProcessImpl.java

示例13: createRequest

import com.sun.jdi.request.EventRequest; //导入依赖的package包/类
protected void createRequest()
{
  final EventRequestManager manager = owner.getEventRequestManager();
  if (manager != null)
  {
    try
    {
      final ClassPrepareRequest request = manager.createClassPrepareRequest();
      owner.jdiManager().modelFilter().filter(request);
      request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
      request.enable();
      owner.addJDIEventListener(this, request);
    }
    catch (final RuntimeException e)
    {
      JiveDebugPlugin.log(e);
    }
  }
}
 
开发者ID:UBPL,项目名称:jive,代码行数:20,代码来源:EventHandlerFactory.java

示例14: removeFieldRequests

import com.sun.jdi.request.EventRequest; //导入依赖的package包/类
protected void removeFieldRequests(final JDIDebugTarget target)
{
  final EventRequestManager manager = target.getEventRequestManager();
  if (manager != null && !fieldRequests.isEmpty())
  {
    try
    {
      manager.deleteEventRequests(fieldRequests);
      for (final EventRequest request : fieldRequests)
      {
        target.removeJDIEventListener(
            request instanceof AccessWatchpointRequest ? fieldReadHandler : fieldWriteHandler,
            request);
      }
    }
    catch (final RuntimeException e)
    {
      JiveDebugPlugin.log(e);
    }
  }
}
 
开发者ID:UBPL,项目名称:jive,代码行数:22,代码来源:EventHandlerFactory.java

示例15: createRequest

import com.sun.jdi.request.EventRequest; //导入依赖的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);
    }
  }
}
 
开发者ID:UBPL,项目名称:jive,代码行数:27,代码来源:JiveThread.java


注:本文中的com.sun.jdi.request.EventRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。