Search in sources :

Example 1 with MethodReturnValueWatcher

use of com.intellij.debugger.engine.requests.MethodReturnValueWatcher in project intellij-community by JetBrains.

the class DebugProcessImpl method getLastExecutedMethod.

@Nullable
public Pair<Method, Value> getLastExecutedMethod() {
    final MethodReturnValueWatcher watcher = myReturnValueWatcher;
    if (watcher == null) {
        return null;
    }
    final Method method = watcher.getLastExecutedMethod();
    if (method == null) {
        return null;
    }
    return Pair.create(method, watcher.getLastMethodReturnValue());
}
Also used : MethodReturnValueWatcher(com.intellij.debugger.engine.requests.MethodReturnValueWatcher) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with MethodReturnValueWatcher

use of com.intellij.debugger.engine.requests.MethodReturnValueWatcher in project intellij-community by JetBrains.

the class DebugProcessEvents method vmAttached.

private void vmAttached() {
    DebuggerManagerThreadImpl.assertIsManagerThread();
    LOG.assertTrue(!isAttached());
    if (myState.compareAndSet(State.INITIAL, State.ATTACHED)) {
        final VirtualMachineProxyImpl machineProxy = getVirtualMachineProxy();
        final EventRequestManager requestManager = machineProxy.eventRequestManager();
        if (machineProxy.canGetMethodReturnValues()) {
            myReturnValueWatcher = new MethodReturnValueWatcher(requestManager);
        }
        final ThreadStartRequest threadStartRequest = requestManager.createThreadStartRequest();
        threadStartRequest.setSuspendPolicy(EventRequest.SUSPEND_NONE);
        threadStartRequest.enable();
        final ThreadDeathRequest threadDeathRequest = requestManager.createThreadDeathRequest();
        threadDeathRequest.setSuspendPolicy(EventRequest.SUSPEND_NONE);
        threadDeathRequest.enable();
        // fill position managers
        ((DebuggerManagerImpl) DebuggerManager.getInstance(getProject())).getCustomPositionManagerFactories().map(factory -> factory.fun(this)).filter(Objects::nonNull).forEach(this::appendPositionManager);
        Stream.of(Extensions.getExtensions(PositionManagerFactory.EP_NAME, getProject())).map(factory -> factory.createPositionManager(this)).filter(Objects::nonNull).forEach(this::appendPositionManager);
        myDebugProcessDispatcher.getMulticaster().processAttached(this);
        createStackCapturingBreakpoints();
        // breakpoints should be initialized after all processAttached listeners work
        ApplicationManager.getApplication().runReadAction(() -> {
            XDebugSession session = getSession().getXDebugSession();
            if (session != null) {
                session.initBreakpoints();
            }
        });
        final String addressDisplayName = DebuggerBundle.getAddressDisplayName(getConnection());
        final String transportName = DebuggerBundle.getTransportName(getConnection());
        showStatusText(DebuggerBundle.message("status.connected", addressDisplayName, transportName));
        LOG.debug("leave: processVMStartEvent()");
    }
}
Also used : XDebugSession(com.intellij.xdebugger.XDebugSession) VirtualMachineProxyImpl(com.intellij.debugger.jdi.VirtualMachineProxyImpl) ThreadStartRequest(com.sun.jdi.request.ThreadStartRequest) ThreadDeathRequest(com.sun.jdi.request.ThreadDeathRequest) EventRequestManager(com.sun.jdi.request.EventRequestManager) MethodReturnValueWatcher(com.intellij.debugger.engine.requests.MethodReturnValueWatcher)

Aggregations

MethodReturnValueWatcher (com.intellij.debugger.engine.requests.MethodReturnValueWatcher)2 VirtualMachineProxyImpl (com.intellij.debugger.jdi.VirtualMachineProxyImpl)1 XDebugSession (com.intellij.xdebugger.XDebugSession)1 EventRequestManager (com.sun.jdi.request.EventRequestManager)1 ThreadDeathRequest (com.sun.jdi.request.ThreadDeathRequest)1 ThreadStartRequest (com.sun.jdi.request.ThreadStartRequest)1 Nullable (org.jetbrains.annotations.Nullable)1