Search in sources :

Example 6 with ObjectCollectedException

use of com.sun.jdi.ObjectCollectedException in project intellij-community by JetBrains.

the class SpringLoadedPositionManager method findNested.

private static void findNested(Set<ReferenceType> res, ReferenceType fromClass, int line) {
    if (!fromClass.isPrepared())
        return;
    List<ReferenceType> nestedTypes = fromClass.nestedTypes();
    ReferenceType springLoadedGeneratedClass = null;
    for (ReferenceType nested : nestedTypes) {
        if (!nested.isPrepared())
            continue;
        if (isSpringLoadedGeneratedClass(fromClass, nested)) {
            if (springLoadedGeneratedClass == null || !springLoadedGeneratedClass.name().equals(nested.name())) {
                // Only latest generated classes should be used.
                springLoadedGeneratedClass = nested;
            }
        } else {
            findNested(res, nested, line);
        }
    }
    try {
        final int lineNumber = line + 1;
        ReferenceType effectiveRef = springLoadedGeneratedClass == null ? fromClass : springLoadedGeneratedClass;
        if (!effectiveRef.locationsOfLine(lineNumber).isEmpty()) {
            res.add(effectiveRef);
        }
    } catch (ObjectCollectedException | AbsentInformationException ignored) {
    }
}
Also used : ObjectCollectedException(com.sun.jdi.ObjectCollectedException) AbsentInformationException(com.sun.jdi.AbsentInformationException) ReferenceType(com.sun.jdi.ReferenceType)

Example 7 with ObjectCollectedException

use of com.sun.jdi.ObjectCollectedException in project kotlin by JetBrains.

the class DebuggerSteppingHelper method createStepRequest.

// copied from DebugProcessImpl.doStep
private static void createStepRequest(@NotNull SuspendContextImpl suspendContext, @Nullable ThreadReferenceProxyImpl stepThread, @NotNull EventRequestManager requestManager, int size, int depth) {
    if (stepThread == null) {
        return;
    }
    try {
        ThreadReference stepThreadReference = stepThread.getThreadReference();
        requestManager.deleteEventRequests(requestManager.stepRequests());
        StepRequest stepRequest = requestManager.createStepRequest(stepThreadReference, size, depth);
        List<ClassFilter> activeFilters = getActiveFilters();
        if (!activeFilters.isEmpty()) {
            String currentClassName = getCurrentClassName(stepThread);
            if (currentClassName == null || !DebuggerUtilsEx.isFiltered(currentClassName, activeFilters)) {
                // add class filters
                for (ClassFilter filter : activeFilters) {
                    stepRequest.addClassExclusionFilter(filter.getPattern());
                }
            }
        }
        // suspend policy to match the suspend policy of the context:
        // if all threads were suspended, then during stepping all the threads must be suspended
        // if only event thread were suspended, then only this particular thread must be suspended during stepping
        stepRequest.setSuspendPolicy(suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD ? EventRequest.SUSPEND_EVENT_THREAD : EventRequest.SUSPEND_ALL);
        stepRequest.enable();
    } catch (ObjectCollectedException ignored) {
    }
}
Also used : ObjectCollectedException(com.sun.jdi.ObjectCollectedException) ClassFilter(com.intellij.ui.classFilter.ClassFilter) StepRequest(com.sun.jdi.request.StepRequest) ThreadReference(com.sun.jdi.ThreadReference)

Aggregations

ObjectCollectedException (com.sun.jdi.ObjectCollectedException)7 SuspendContextImpl (com.intellij.debugger.engine.SuspendContextImpl)2 SuspendManager (com.intellij.debugger.engine.SuspendManager)2 ThreadGroupReferenceProxyImpl (com.intellij.debugger.jdi.ThreadGroupReferenceProxyImpl)2 ThreadReferenceProxyImpl (com.intellij.debugger.jdi.ThreadReferenceProxyImpl)2 ClassFilter (com.intellij.ui.classFilter.ClassFilter)1 ValueMarkup (com.intellij.xdebugger.impl.ui.tree.ValueMarkup)1 AbsentInformationException (com.sun.jdi.AbsentInformationException)1 ObjectReference (com.sun.jdi.ObjectReference)1 ReferenceType (com.sun.jdi.ReferenceType)1 ThreadReference (com.sun.jdi.ThreadReference)1 StepRequest (com.sun.jdi.request.StepRequest)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1