Search in sources :

Example 1 with IntegerValue

use of com.sun.jdi.IntegerValue in project gravel by gravel-st.

the class VMTargetRemoteTest method testEvaluate.

@Test
public void testEvaluate() throws Throwable {
    ObjectReference promise = remote.evaluateForked("3+4");
    ThreadReference thread = ((ThreadReference) remote.invokeMethod(promise, "thread"));
    Value result1 = remote.invokeMethod(promise, "result");
    Value ex = remote.invokeMethod(promise, "throwable");
    printThreadState();
    VMTargetStarter.sleep(100);
    printThreadState();
    boolean isFinished = ((BooleanValue) remote.invokeMethod(promise, "isFinished")).booleanValue();
    assertTrue(isFinished);
    ObjectReference result = (ObjectReference) remote.invokeMethod(promise, "result");
    IntegerValue intValue = (IntegerValue) remote.invokeMethod(result, "intValue");
    assertEquals(7, intValue.intValue());
}
Also used : ObjectReference(com.sun.jdi.ObjectReference) BooleanValue(com.sun.jdi.BooleanValue) IntegerValue(com.sun.jdi.IntegerValue) IntegerValue(com.sun.jdi.IntegerValue) BooleanValue(com.sun.jdi.BooleanValue) Value(com.sun.jdi.Value) ThreadReference(com.sun.jdi.ThreadReference) Test(org.junit.Test)

Example 2 with IntegerValue

use of com.sun.jdi.IntegerValue in project android by JetBrains.

the class ResolveTypedIntegerCommand method action.

@Override
public void action() {
    // TODO: see if it is possible to cache this evaluation
    // if (myIsEvaluated) return;
    DebugProcess debugProcess = myEvaluationContext.getDebugProcess();
    if (!(debugProcess instanceof DebugProcessImpl)) {
        return;
    }
    final DebuggerContextImpl debuggerContext = ((DebugProcessImpl) debugProcess).getDebuggerContext();
    PsiAnnotation annotation = ApplicationManager.getApplication().runReadAction(new Computable<PsiAnnotation>() {

        @Override
        public PsiAnnotation compute() {
            try {
                return getAnnotation(debuggerContext);
            } catch (IndexNotReadyException e) {
                return null;
            }
        }
    });
    if (annotation != null) {
        ResourceIdResolver resolver = ServiceManager.getService(myEvaluationContext.getProject(), ResourceIdResolver.class);
        DynamicResourceIdResolver resolver1 = new DynamicResourceIdResolver(myEvaluationContext, resolver);
        myResult = AnnotationsRenderer.render(resolver1, annotation, ((IntegerValue) myValue).value());
    }
    evaluationResult("");
}
Also used : DebugProcess(com.intellij.debugger.engine.DebugProcess) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) IntegerValue(com.sun.jdi.IntegerValue) IndexNotReadyException(com.intellij.openapi.project.IndexNotReadyException) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl) PsiAnnotation(com.intellij.psi.PsiAnnotation)

Aggregations

IntegerValue (com.sun.jdi.IntegerValue)2 DebugProcess (com.intellij.debugger.engine.DebugProcess)1 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)1 DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)1 IndexNotReadyException (com.intellij.openapi.project.IndexNotReadyException)1 PsiAnnotation (com.intellij.psi.PsiAnnotation)1 BooleanValue (com.sun.jdi.BooleanValue)1 ObjectReference (com.sun.jdi.ObjectReference)1 ThreadReference (com.sun.jdi.ThreadReference)1 Value (com.sun.jdi.Value)1 Test (org.junit.Test)1