Search in sources :

Example 1 with ThreadReferenceProxy

use of com.intellij.debugger.engine.jdi.ThreadReferenceProxy in project intellij-community by JetBrains.

the class BatchEvaluator method hasBatchEvaluator.

@SuppressWarnings({ "HardCodedStringLiteral" })
public boolean hasBatchEvaluator(EvaluationContext evaluationContext) {
    if (!myBatchEvaluatorChecked) {
        myBatchEvaluatorChecked = true;
        if (DebuggerUtilsImpl.isRemote(myDebugProcess)) {
            // optimization: for remote sessions the BatchEvaluator is not there for sure
            return false;
        }
        ThreadReferenceProxy thread = evaluationContext.getSuspendContext().getThread();
        if (thread == null) {
            return false;
        }
        ThreadReference threadReference = thread.getThreadReference();
        if (threadReference == null) {
            return false;
        }
        ClassType batchEvaluatorClass = null;
        try {
            batchEvaluatorClass = (ClassType) myDebugProcess.findClass(evaluationContext, BatchEvaluatorServer.class.getName(), evaluationContext.getClassLoader());
        } catch (EvaluateException e) {
        }
        if (batchEvaluatorClass != null) {
            Method constructor = batchEvaluatorClass.concreteMethodByName(JVMNameUtil.CONSTRUCTOR_NAME, "()V");
            if (constructor != null) {
                ObjectReference evaluator = null;
                try {
                    evaluator = myDebugProcess.newInstance(evaluationContext, batchEvaluatorClass, constructor, Collections.emptyList());
                } catch (Exception e) {
                    LOG.debug(e);
                }
                myBatchEvaluatorObject = evaluator;
                if (myBatchEvaluatorObject != null) {
                    myBatchEvaluatorMethod = batchEvaluatorClass.concreteMethodByName("evaluate", "([Ljava/lang/Object;)[Ljava/lang/Object;");
                }
            }
        }
    }
    return myBatchEvaluatorMethod != null;
}
Also used : EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException) ThreadReferenceProxy(com.intellij.debugger.engine.jdi.ThreadReferenceProxy) EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException) BatchEvaluatorServer(com.intellij.rt.debugger.BatchEvaluatorServer)

Example 2 with ThreadReferenceProxy

use of com.intellij.debugger.engine.jdi.ThreadReferenceProxy in project intellij-community by JetBrains.

the class NodeDescriptorFactoryImpl method createDescriptorTree.

private static DescriptorTree createDescriptorTree(final StackFrameProxy frameProxy, final DescriptorTree fromTree) {
    int frameCount = -1;
    int frameIndex = -1;
    if (frameProxy != null) {
        try {
            final ThreadReferenceProxy threadReferenceProxy = frameProxy.threadProxy();
            frameCount = threadReferenceProxy.frameCount();
            frameIndex = frameProxy.getFrameIndex();
        } catch (EvaluateException e) {
        // ignored
        }
    }
    final boolean isInitial = !fromTree.frameIdEquals(frameCount, frameIndex);
    DescriptorTree descriptorTree = new DescriptorTree(isInitial);
    descriptorTree.setFrameId(frameCount, frameIndex);
    return descriptorTree;
}
Also used : EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException) ThreadReferenceProxy(com.intellij.debugger.engine.jdi.ThreadReferenceProxy)

Aggregations

EvaluateException (com.intellij.debugger.engine.evaluation.EvaluateException)2 ThreadReferenceProxy (com.intellij.debugger.engine.jdi.ThreadReferenceProxy)2 BatchEvaluatorServer (com.intellij.rt.debugger.BatchEvaluatorServer)1