Search in sources :

Example 26 with DebugProcessImpl

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

the class DebuggerTree method rebuild.

public void rebuild(final DebuggerContextImpl context) {
    ApplicationManager.getApplication().assertIsDispatchThread();
    final DebugProcessImpl process = context.getDebugProcess();
    if (process == null) {
        // empty context, no process available yet
        return;
    }
    myDebuggerContext = context;
    saveState();
    process.getManagerThread().schedule(new DebuggerCommandImpl() {

        @Override
        protected void action() throws Exception {
            getNodeFactory().setHistoryByContext(context);
        }

        @Override
        public Priority getPriority() {
            return Priority.NORMAL;
        }
    });
    build(context);
}
Also used : DebuggerCommandImpl(com.intellij.debugger.engine.events.DebuggerCommandImpl) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException)

Example 27 with DebugProcessImpl

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

the class DebuggerTestCase method createRemoteProcess.

protected DebuggerSession createRemoteProcess(final int transport, final boolean serverMode, JavaParameters javaParameters) throws ExecutionException, InterruptedException, InvocationTargetException {
    boolean useSockets = transport == DebuggerSettings.SOCKET_TRANSPORT;
    RemoteConnection remoteConnection = new RemoteConnection(useSockets, "127.0.0.1", String.valueOf(DEFAULT_ADDRESS), serverMode);
    String launchCommandLine = remoteConnection.getLaunchCommandLine();
    launchCommandLine = StringUtil.replace(launchCommandLine, RemoteConnection.ONTHROW, "");
    launchCommandLine = StringUtil.replace(launchCommandLine, RemoteConnection.ONUNCAUGHT, "");
    launchCommandLine = StringUtil.replace(launchCommandLine, "suspend=n", "suspend=y");
    println(launchCommandLine, ProcessOutputTypes.SYSTEM);
    for (StringTokenizer tokenizer = new StringTokenizer(launchCommandLine); tokenizer.hasMoreTokens(); ) {
        String token = tokenizer.nextToken();
        javaParameters.getVMParametersList().add(token);
    }
    GeneralCommandLine commandLine = javaParameters.toCommandLine();
    DebuggerSession debuggerSession;
    if (serverMode) {
        debuggerSession = attachVM(remoteConnection, false);
        commandLine.createProcess();
    } else {
        commandLine.createProcess();
        debuggerSession = attachVM(remoteConnection, true);
    }
    ProcessHandler processHandler = debuggerSession.getProcess().getProcessHandler();
    DebugProcessImpl process = (DebugProcessImpl) DebuggerManagerEx.getInstanceEx(myProject).getDebugProcess(processHandler);
    assertNotNull(process);
    return debuggerSession;
}
Also used : StringTokenizer(java.util.StringTokenizer) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) ProcessHandler(com.intellij.execution.process.ProcessHandler)

Example 28 with DebugProcessImpl

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

the class DescriptorTestCase method resume.

@Override
protected void resume(final SuspendContextImpl suspendContext) {
    final DebugProcessImpl localProcess = suspendContext.getDebugProcess();
    invokeRatherLater(new SuspendContextCommandImpl(suspendContext) {

        @Override
        public void contextAction() throws Exception {
            flushDescriptors();
            localProcess.getManagerThread().schedule(localProcess.createResumeCommand(suspendContext, Priority.LOW));
        }
    });
}
Also used : DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) SuspendContextCommandImpl(com.intellij.debugger.engine.events.SuspendContextCommandImpl) EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException)

Example 29 with DebugProcessImpl

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

Example 30 with DebugProcessImpl

use of com.intellij.debugger.engine.DebugProcessImpl in project android by JetBrains.

the class BitmapEvaluatorProvider method downsizeBitmap.

@Override
public boolean downsizeBitmap(@NotNull Dimension currentDimensions) throws EvaluateException {
    DebugProcessImpl debugProcess = myEvaluationContext.getDebugProcess();
    Method createScaledBitmapMethod = DebuggerUtils.findMethod(myBitmap.referenceType(), "createScaledBitmap", "(Landroid/graphics/Bitmap;IIZ)Landroid/graphics/Bitmap;");
    if (createScaledBitmapMethod == null) {
        return false;
    }
    double s = Math.max(currentDimensions.getHeight(), currentDimensions.getWidth()) / MAX_DIMENSION;
    VirtualMachineProxyImpl vm = myEvaluationContext.getDebugProcess().getVirtualMachineProxy();
    Value dstWidth = DebuggerUtilsEx.createValue(vm, "int", (int) (currentDimensions.getWidth() / s));
    Value dstHeight = DebuggerUtilsEx.createValue(vm, "int", (int) (currentDimensions.getHeight() / s));
    Value filter = DebuggerUtilsEx.createValue(vm, "boolean", Boolean.FALSE);
    Value result = debugProcess.invokeMethod(myEvaluationContext, myBitmap, createScaledBitmapMethod, Arrays.asList(myBitmap, dstWidth, dstHeight, filter));
    if (result != null) {
        myBitmap = (ObjectReference) result;
    }
    return result != null;
}
Also used : VirtualMachineProxyImpl(com.intellij.debugger.jdi.VirtualMachineProxyImpl) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl)

Aggregations

DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)55 DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)20 EvaluateException (com.intellij.debugger.engine.evaluation.EvaluateException)15 Project (com.intellij.openapi.project.Project)15 Nullable (org.jetbrains.annotations.Nullable)11 DebuggerCommandImpl (com.intellij.debugger.engine.events.DebuggerCommandImpl)9 DebuggerTreeNodeImpl (com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl)9 DebuggerContextCommandImpl (com.intellij.debugger.engine.events.DebuggerContextCommandImpl)7 List (java.util.List)7 SourcePosition (com.intellij.debugger.SourcePosition)5 JavaValue (com.intellij.debugger.engine.JavaValue)5 StackFrameProxyImpl (com.intellij.debugger.jdi.StackFrameProxyImpl)5 ThreadReferenceProxyImpl (com.intellij.debugger.jdi.ThreadReferenceProxyImpl)5 VirtualMachineProxyImpl (com.intellij.debugger.jdi.VirtualMachineProxyImpl)5 DebuggerSession (com.intellij.debugger.impl.DebuggerSession)4 NodeDescriptorImpl (com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl)4 ThreadDescriptorImpl (com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl)4 XDebugSession (com.intellij.xdebugger.XDebugSession)4 ArrayList (java.util.ArrayList)4 NotNull (org.jetbrains.annotations.NotNull)4