Search in sources :

Example 1 with RequestManagerImpl

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

the class BreakpointManager method applyThreadFilter.

public void applyThreadFilter(@NotNull final DebugProcessImpl debugProcess, @Nullable ThreadReference newFilterThread) {
    final RequestManagerImpl requestManager = debugProcess.getRequestsManager();
    final ThreadReference oldFilterThread = requestManager.getFilterThread();
    if (Comparing.equal(newFilterThread, oldFilterThread)) {
        // the filter already added
        return;
    }
    requestManager.setFilterThread(newFilterThread);
    if (newFilterThread == null || oldFilterThread != null) {
        final List<Breakpoint> breakpoints = getBreakpoints();
        for (Breakpoint breakpoint : breakpoints) {
            if (LineBreakpoint.CATEGORY.equals(breakpoint.getCategory()) || MethodBreakpoint.CATEGORY.equals(breakpoint.getCategory())) {
                requestManager.deleteRequest(breakpoint);
                breakpoint.createRequest(debugProcess);
            }
        }
    } else {
        // important! need to add filter to _existing_ requests, otherwise Requestor->Request mapping will be lost
        // and debugger trees will not be restored to original state
        EventRequestManager eventRequestManager = requestManager.getVMRequestManager();
        if (eventRequestManager != null) {
            applyFilter(eventRequestManager.breakpointRequests(), request -> request.addThreadFilter(newFilterThread));
            applyFilter(eventRequestManager.methodEntryRequests(), request -> request.addThreadFilter(newFilterThread));
            applyFilter(eventRequestManager.methodExitRequests(), request -> request.addThreadFilter(newFilterThread));
        }
    }
}
Also used : ThreadReference(com.sun.jdi.ThreadReference) EventRequestManager(com.sun.jdi.request.EventRequestManager) RequestManagerImpl(com.intellij.debugger.engine.requests.RequestManagerImpl)

Example 2 with RequestManagerImpl

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

the class BreakpointManager method disableBreakpoints.

//interaction with RequestManagerImpl
public void disableBreakpoints(@NotNull final DebugProcessImpl debugProcess) {
    final List<Breakpoint> breakpoints = getBreakpoints();
    if (!breakpoints.isEmpty()) {
        final RequestManagerImpl requestManager = debugProcess.getRequestsManager();
        for (Breakpoint breakpoint : breakpoints) {
            breakpoint.markVerified(requestManager.isVerified(breakpoint));
            requestManager.deleteRequest(breakpoint);
        }
        SwingUtilities.invokeLater(this::updateBreakpointsUI);
    }
}
Also used : RequestManagerImpl(com.intellij.debugger.engine.requests.RequestManagerImpl)

Example 3 with RequestManagerImpl

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

the class ExceptionBreakpoint method processClassPrepare.

public void processClassPrepare(DebugProcess process, ReferenceType refType) {
    DebugProcessImpl debugProcess = (DebugProcessImpl) process;
    if (shouldCreateRequest(debugProcess, true)) {
        // trying to create a request
        RequestManagerImpl manager = debugProcess.getRequestsManager();
        manager.enableRequest(manager.createExceptionRequest(this, refType, isNotifyCaught(), isNotifyUncaught()));
        if (LOG.isDebugEnabled()) {
            if (refType != null) {
                LOG.debug("Created exception request for reference type " + refType.name());
            } else {
                LOG.debug("Created exception request for reference type null");
            }
        }
    }
}
Also used : RequestManagerImpl(com.intellij.debugger.engine.requests.RequestManagerImpl)

Example 4 with RequestManagerImpl

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

the class DebuggerUtilsEx method getEventDescriptors.

@NotNull
public static List<Pair<Breakpoint, Event>> getEventDescriptors(@Nullable SuspendContextImpl suspendContext) {
    DebuggerManagerThreadImpl.assertIsManagerThread();
    if (suspendContext != null) {
        EventSet events = suspendContext.getEventSet();
        if (!ContainerUtil.isEmpty(events)) {
            List<Pair<Breakpoint, Event>> eventDescriptors = ContainerUtil.newSmartList();
            RequestManagerImpl requestManager = suspendContext.getDebugProcess().getRequestsManager();
            for (Event event : events) {
                Requestor requestor = requestManager.findRequestor(event.request());
                if (requestor instanceof Breakpoint) {
                    eventDescriptors.add(Pair.create((Breakpoint) requestor, event));
                }
            }
            return eventDescriptors;
        }
    }
    return Collections.emptyList();
}
Also used : Breakpoint(com.intellij.debugger.ui.breakpoints.Breakpoint) EventSet(com.sun.jdi.event.EventSet) Event(com.sun.jdi.event.Event) Requestor(com.intellij.debugger.requests.Requestor) RequestManagerImpl(com.intellij.debugger.engine.requests.RequestManagerImpl) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with RequestManagerImpl

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

the class MethodBreakpoint method createRequestForSubClasses.

private static void createRequestForSubClasses(@NotNull MethodBreakpointBase breakpoint, @NotNull DebugProcessImpl debugProcess, @NotNull ReferenceType baseType) {
    DebuggerManagerThreadImpl.assertIsManagerThread();
    RequestManagerImpl requestsManager = debugProcess.getRequestsManager();
    ClassPrepareRequest request = requestsManager.createClassPrepareRequest((debuggerProcess, referenceType) -> {
        if (instanceOf(referenceType, baseType)) {
            createRequestForPreparedClassEmulated(breakpoint, debugProcess, referenceType, false);
        }
    }, null);
    if (request != null) {
        requestsManager.registerRequest(breakpoint, request);
        request.enable();
        // to force reload classes available so far
        debugProcess.getVirtualMachineProxy().clearCaches();
    }
    AtomicReference<ProgressIndicator> indicatorRef = new AtomicReference<>();
    ApplicationManager.getApplication().invokeAndWait(() -> indicatorRef.set(new ProgressWindowWithNotification(true, false, debugProcess.getProject(), "Cancel emulation")));
    ProgressIndicator indicator = indicatorRef.get();
    ProgressManager.getInstance().executeProcessUnderProgress(() -> processPreparedSubTypes(baseType, subType -> createRequestForPreparedClassEmulated(breakpoint, debugProcess, subType, false), indicator), indicator);
    if (indicator.isCanceled()) {
        breakpoint.disableEmulation();
    }
}
Also used : com.intellij.openapi.util(com.intellij.openapi.util) MethodEntryEvent(com.sun.jdi.event.MethodEntryEvent) JVMNameUtil(com.intellij.debugger.engine.JVMNameUtil) AllIcons(com.intellij.icons.AllIcons) Document(com.intellij.openapi.editor.Document) Opcodes(org.jetbrains.org.objectweb.asm.Opcodes) DebuggerUtilsEx(com.intellij.debugger.impl.DebuggerUtilsEx) EventRequest(com.sun.jdi.request.EventRequest) EvaluationContextImpl(com.intellij.debugger.engine.evaluation.EvaluationContextImpl) StringBuilderSpinAllocator(com.intellij.util.StringBuilderSpinAllocator) ProgressWindowWithNotification(com.intellij.openapi.progress.util.ProgressWindowWithNotification) Logger(com.intellij.openapi.diagnostic.Logger) MultiMap(com.intellij.util.containers.MultiMap) MethodEntryRequest(com.sun.jdi.request.MethodEntryRequest) DebuggerManagerThreadImpl(com.intellij.debugger.engine.DebuggerManagerThreadImpl) EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException) ProgressManager(com.intellij.openapi.progress.ProgressManager) IndexNotReadyException(com.intellij.openapi.project.IndexNotReadyException) MethodExitRequest(com.sun.jdi.request.MethodExitRequest) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) PositionUtil(com.intellij.debugger.impl.PositionUtil) MethodExitEvent(com.sun.jdi.event.MethodExitEvent) XBreakpoint(com.intellij.xdebugger.breakpoints.XBreakpoint) Nullable(org.jetbrains.annotations.Nullable) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) List(java.util.List) Stream(java.util.stream.Stream) StreamEx(one.util.streamex.StreamEx) ApplicationManager(com.intellij.openapi.application.ApplicationManager) Requestor(com.intellij.debugger.requests.Requestor) com.intellij.psi(com.intellij.psi) NotNull(org.jetbrains.annotations.NotNull) SourcePosition(com.intellij.debugger.SourcePosition) LocatableEvent(com.sun.jdi.event.LocatableEvent) Label(org.jetbrains.org.objectweb.asm.Label) NonNls(org.jetbrains.annotations.NonNls) MethodBytecodeUtil(com.intellij.debugger.jdi.MethodBytecodeUtil) ContainerUtil(com.intellij.util.containers.ContainerUtil) AtomicReference(java.util.concurrent.atomic.AtomicReference) RequestManagerImpl(com.intellij.debugger.engine.requests.RequestManagerImpl) Project(com.intellij.openapi.project.Project) DebuggerBundle(com.intellij.debugger.DebuggerBundle) JavaMethodBreakpointProperties(org.jetbrains.java.debugger.breakpoints.properties.JavaMethodBreakpointProperties) MethodVisitor(org.jetbrains.org.objectweb.asm.MethodVisitor) JVMName(com.intellij.debugger.engine.JVMName) Consumer(java.util.function.Consumer) ClassPrepareRequest(com.sun.jdi.request.ClassPrepareRequest) DebuggerManagerEx(com.intellij.debugger.DebuggerManagerEx) com.sun.jdi(com.sun.jdi) Element(org.jdom.Element) javax.swing(javax.swing) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) ProgressWindowWithNotification(com.intellij.openapi.progress.util.ProgressWindowWithNotification) AtomicReference(java.util.concurrent.atomic.AtomicReference) RequestManagerImpl(com.intellij.debugger.engine.requests.RequestManagerImpl) ClassPrepareRequest(com.sun.jdi.request.ClassPrepareRequest)

Aggregations

RequestManagerImpl (com.intellij.debugger.engine.requests.RequestManagerImpl)10 EvaluateException (com.intellij.debugger.engine.evaluation.EvaluateException)4 IndexNotReadyException (com.intellij.openapi.project.IndexNotReadyException)3 MethodEntryRequest (com.sun.jdi.request.MethodEntryRequest)3 MethodExitRequest (com.sun.jdi.request.MethodExitRequest)3 Requestor (com.intellij.debugger.requests.Requestor)2 InvalidDataException (com.intellij.openapi.util.InvalidDataException)2 DebuggerBundle (com.intellij.debugger.DebuggerBundle)1 DebuggerManagerEx (com.intellij.debugger.DebuggerManagerEx)1 SourcePosition (com.intellij.debugger.SourcePosition)1 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)1 DebuggerManagerThreadImpl (com.intellij.debugger.engine.DebuggerManagerThreadImpl)1 JVMName (com.intellij.debugger.engine.JVMName)1 JVMNameUtil (com.intellij.debugger.engine.JVMNameUtil)1 EvaluationContextImpl (com.intellij.debugger.engine.evaluation.EvaluationContextImpl)1 VirtualMachineProxy (com.intellij.debugger.engine.jdi.VirtualMachineProxy)1 DebuggerUtilsEx (com.intellij.debugger.impl.DebuggerUtilsEx)1 PositionUtil (com.intellij.debugger.impl.PositionUtil)1 MethodBytecodeUtil (com.intellij.debugger.jdi.MethodBytecodeUtil)1 Breakpoint (com.intellij.debugger.ui.breakpoints.Breakpoint)1