Search in sources :

Example 1 with DebugProcess

use of com.intellij.debugger.engine.DebugProcess in project smali by JesusFreke.

the class SmaliPositionManager method createPrepareRequest.

@Override
public ClassPrepareRequest createPrepareRequest(@NotNull final ClassPrepareRequestor requestor, @NotNull final SourcePosition position) throws NoDataException {
    Computable<Boolean> isSmaliFile = new Computable<Boolean>() {

        @Override
        public Boolean compute() {
            return position.getFile() instanceof SmaliFile;
        }
    };
    ApplicationManager.getApplication().runReadAction(isSmaliFile);
    if (!isSmaliFile.compute()) {
        throw NoDataException.INSTANCE;
    }
    String className = getClassFromPosition(position);
    return debugProcess.getRequestsManager().createClassPrepareRequest(new ClassPrepareRequestor() {

        @Override
        public void processClassPrepare(DebugProcess debuggerProcess, ReferenceType referenceType) {
            requestor.processClassPrepare(debuggerProcess, referenceType);
        }
    }, className);
}
Also used : SmaliFile(org.jf.smalidea.psi.impl.SmaliFile) ClassPrepareRequestor(com.intellij.debugger.requests.ClassPrepareRequestor) DebugProcess(com.intellij.debugger.engine.DebugProcess) Computable(com.intellij.openapi.util.Computable) ReferenceType(com.sun.jdi.ReferenceType)

Example 2 with DebugProcess

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

the class ClassLoadingUtils method createURLArray.

private static ArrayReference createURLArray(EvaluationContext context) throws EvaluateException, InvalidTypeException, ClassNotLoadedException {
    DebugProcess process = context.getDebugProcess();
    ArrayType arrayType = (ArrayType) process.findClass(context, "java.net.URL[]", context.getClassLoader());
    ArrayReference arrayRef = arrayType.newInstance(1);
    DebuggerUtilsEx.keep(arrayRef, context);
    ClassType classType = (ClassType) process.findClass(context, "java.net.URL", context.getClassLoader());
    VirtualMachineProxyImpl proxy = (VirtualMachineProxyImpl) process.getVirtualMachineProxy();
    StringReference url = proxy.mirrorOf("file:a");
    DebuggerUtilsEx.keep(url, context);
    ObjectReference reference = process.newInstance(context, classType, classType.concreteMethodByName(JVMNameUtil.CONSTRUCTOR_NAME, "(Ljava/lang/String;)V"), Collections.singletonList(url));
    DebuggerUtilsEx.keep(reference, context);
    arrayRef.setValues(Collections.singletonList(reference));
    return arrayRef;
}
Also used : DebugProcess(com.intellij.debugger.engine.DebugProcess) VirtualMachineProxyImpl(com.intellij.debugger.jdi.VirtualMachineProxyImpl)

Example 3 with DebugProcess

use of com.intellij.debugger.engine.DebugProcess in project kotlin by JetBrains.

the class CompilingEvaluatorUtils method createURLArray.

private static ArrayReference createURLArray(EvaluationContext context) throws EvaluateException, InvocationException, InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException {
    DebugProcess process = context.getDebugProcess();
    ArrayType arrayType = (ArrayType) process.findClass(context, "java.net.URL[]", context.getClassLoader());
    ArrayReference arrayRef = arrayType.newInstance(1);
    keep(arrayRef, context);
    ClassType classType = (ClassType) process.findClass(context, "java.net.URL", context.getClassLoader());
    VirtualMachineProxyImpl proxy = (VirtualMachineProxyImpl) process.getVirtualMachineProxy();
    StringReference url = proxy.mirrorOf("file:a");
    keep(url, context);
    ObjectReference reference = process.newInstance(context, classType, classType.concreteMethodByName("<init>", "(Ljava/lang/String;)V"), Collections.singletonList(url));
    keep(reference, context);
    arrayRef.setValues(Collections.singletonList(reference));
    return arrayRef;
}
Also used : DebugProcess(com.intellij.debugger.engine.DebugProcess) VirtualMachineProxyImpl(com.intellij.debugger.jdi.VirtualMachineProxyImpl)

Example 4 with DebugProcess

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

the class ImageObjectRenderer method getImageBytes.

private static Value getImageBytes(EvaluationContext evaluationContext, Value obj, String methodName) throws EvaluateException {
    DebugProcess process = evaluationContext.getDebugProcess();
    EvaluationContext copyContext = evaluationContext.createEvaluationContext(obj);
    ClassType helperClass = ClassLoadingUtils.getHelperClass(ImageSerializer.class.getName(), copyContext, process);
    if (helperClass != null) {
        List<Method> methods = helperClass.methodsByName(methodName);
        if (!methods.isEmpty()) {
            return process.invokeMethod(copyContext, helperClass, methods.get(0), Collections.singletonList(obj));
        }
    }
    return null;
}
Also used : DebugProcess(com.intellij.debugger.engine.DebugProcess) EvaluationContext(com.intellij.debugger.engine.evaluation.EvaluationContext) ImageSerializer(com.intellij.rt.debugger.ImageSerializer)

Example 5 with DebugProcess

use of com.intellij.debugger.engine.DebugProcess 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

DebugProcess (com.intellij.debugger.engine.DebugProcess)18 VirtualMachineProxyImpl (com.intellij.debugger.jdi.VirtualMachineProxyImpl)4 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)3 DebugProcessListener (com.intellij.debugger.engine.DebugProcessListener)3 DebugEnvironment (com.intellij.debugger.DebugEnvironment)2 EvaluateException (com.intellij.debugger.engine.evaluation.EvaluateException)2 EvaluationContext (com.intellij.debugger.engine.evaluation.EvaluationContext)2 ExpressionEvaluator (com.intellij.debugger.engine.evaluation.expression.ExpressionEvaluator)2 ClassPrepareRequestor (com.intellij.debugger.requests.ClassPrepareRequestor)2 ExecutionException (com.intellij.execution.ExecutionException)2 RemoteConnection (com.intellij.execution.configurations.RemoteConnection)2 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)2 ReferenceType (com.sun.jdi.ReferenceType)2 Nullable (org.jetbrains.annotations.Nullable)2 DebugUIEnvironment (com.intellij.debugger.DebugUIEnvironment)1 DefaultDebugEnvironment (com.intellij.debugger.DefaultDebugEnvironment)1 SourcePosition (com.intellij.debugger.SourcePosition)1 CompoundPositionManager (com.intellij.debugger.engine.CompoundPositionManager)1 RemoteDebugProcessHandler (com.intellij.debugger.engine.RemoteDebugProcessHandler)1 DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)1