Search in sources :

Example 1 with MethodExitRequest

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

the class MethodBreakpoint method createRequestForPreparedClassOriginal.

private void createRequestForPreparedClassOriginal(@NotNull DebugProcessImpl debugProcess, @NotNull ReferenceType classType) {
    try {
        boolean hasMethod = false;
        for (Method method : classType.allMethods()) {
            String signature = method.signature();
            String name = method.name();
            if (getMethodName().equals(name) && mySignature.getName(debugProcess).equals(signature)) {
                hasMethod = true;
                break;
            }
        }
        if (!hasMethod) {
            debugProcess.getRequestsManager().setInvalid(this, DebuggerBundle.message("error.invalid.breakpoint.method.not.found", classType.name()));
            return;
        }
        RequestManagerImpl requestManager = debugProcess.getRequestsManager();
        if (isWatchEntry()) {
            MethodEntryRequest entryRequest = findRequest(debugProcess, MethodEntryRequest.class, this);
            if (entryRequest == null) {
                entryRequest = requestManager.createMethodEntryRequest(this);
            } else {
                entryRequest.disable();
            }
            //entryRequest.addClassFilter(myClassQualifiedName);
            // use addClassFilter(ReferenceType) in order to stop on subclasses also!
            entryRequest.addClassFilter(classType);
            debugProcess.getRequestsManager().enableRequest(entryRequest);
        }
        if (isWatchExit()) {
            MethodExitRequest exitRequest = findRequest(debugProcess, MethodExitRequest.class, this);
            if (exitRequest == null) {
                exitRequest = requestManager.createMethodExitRequest(this);
            } else {
                exitRequest.disable();
            }
            //exitRequest.addClassFilter(myClassQualifiedName);
            exitRequest.addClassFilter(classType);
            debugProcess.getRequestsManager().enableRequest(exitRequest);
        }
    } catch (Exception e) {
        LOG.debug(e);
    }
}
Also used : MethodExitRequest(com.sun.jdi.request.MethodExitRequest) MethodEntryRequest(com.sun.jdi.request.MethodEntryRequest) RequestManagerImpl(com.intellij.debugger.engine.requests.RequestManagerImpl) EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException) IndexNotReadyException(com.intellij.openapi.project.IndexNotReadyException)

Example 2 with MethodExitRequest

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

the class WildcardMethodBreakpoint method createRequest.

public void createRequest(DebugProcessImpl debugProcess) {
    DebuggerManagerThreadImpl.assertIsManagerThread();
    if (!shouldCreateRequest(debugProcess)) {
        return;
    }
    if (isEmulated()) {
        createOrWaitPrepare(debugProcess, getClassPattern());
    } else {
        try {
            RequestManagerImpl requestManager = debugProcess.getRequestsManager();
            if (isWatchEntry()) {
                MethodEntryRequest entryRequest = MethodBreakpoint.findRequest(debugProcess, MethodEntryRequest.class, this);
                if (entryRequest == null) {
                    entryRequest = requestManager.createMethodEntryRequest(this);
                } else {
                    entryRequest.disable();
                }
                entryRequest.addClassFilter(getClassPattern());
                debugProcess.getRequestsManager().enableRequest(entryRequest);
            }
            if (isWatchExit()) {
                MethodExitRequest exitRequest = MethodBreakpoint.findRequest(debugProcess, MethodExitRequest.class, this);
                if (exitRequest == null) {
                    exitRequest = requestManager.createMethodExitRequest(this);
                } else {
                    exitRequest.disable();
                }
                exitRequest.addClassFilter(getClassPattern());
                debugProcess.getRequestsManager().enableRequest(exitRequest);
            }
        } catch (Exception e) {
            LOG.debug(e);
        }
    }
}
Also used : MethodExitRequest(com.sun.jdi.request.MethodExitRequest) MethodEntryRequest(com.sun.jdi.request.MethodEntryRequest) RequestManagerImpl(com.intellij.debugger.engine.requests.RequestManagerImpl) InvalidDataException(com.intellij.openapi.util.InvalidDataException) EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException) PatternSyntaxException(java.util.regex.PatternSyntaxException) AbsentInformationException(com.sun.jdi.AbsentInformationException)

Aggregations

EvaluateException (com.intellij.debugger.engine.evaluation.EvaluateException)2 RequestManagerImpl (com.intellij.debugger.engine.requests.RequestManagerImpl)2 MethodEntryRequest (com.sun.jdi.request.MethodEntryRequest)2 MethodExitRequest (com.sun.jdi.request.MethodExitRequest)2 IndexNotReadyException (com.intellij.openapi.project.IndexNotReadyException)1 InvalidDataException (com.intellij.openapi.util.InvalidDataException)1 AbsentInformationException (com.sun.jdi.AbsentInformationException)1 PatternSyntaxException (java.util.regex.PatternSyntaxException)1