Search in sources :

Example 1 with InvalidStackFrameException

use of com.sun.jdi.InvalidStackFrameException in project che by eclipse.

the class JdiStackFrameImpl method getFields.

@Override
public JdiField[] getFields() throws DebuggerException {
    if (fields == null) {
        try {
            ObjectReference object = stackFrame.thisObject();
            if (object == null) {
                ReferenceType type = stackFrame.location().declaringType();
                List<Field> fs = stackFrame.location().declaringType().allFields();
                fields = new JdiField[fs.size()];
                int i = 0;
                for (Field f : fs) {
                    fields[i++] = new JdiFieldImpl(f, type);
                }
            } else {
                List<Field> fs = object.referenceType().allFields();
                fields = new JdiField[fs.size()];
                int i = 0;
                for (Field f : fs) {
                    fields[i++] = new JdiFieldImpl(f, object);
                }
            }
            Arrays.sort(fields);
        } catch (InvalidStackFrameException e) {
            throw new DebuggerException(e.getMessage(), e);
        }
    }
    return fields;
}
Also used : Field(com.sun.jdi.Field) ObjectReference(com.sun.jdi.ObjectReference) DebuggerException(org.eclipse.che.api.debugger.server.exceptions.DebuggerException) InvalidStackFrameException(com.sun.jdi.InvalidStackFrameException) ReferenceType(com.sun.jdi.ReferenceType)

Example 2 with InvalidStackFrameException

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

the class PopFrameAction method actionPerformed.

public void actionPerformed(@NotNull AnActionEvent e) {
    final Project project = e.getData(CommonDataKeys.PROJECT);
    final JavaStackFrame stackFrame = getStackFrame(e);
    if (stackFrame == null || stackFrame.getStackFrameProxy().isBottom()) {
        return;
    }
    try {
        final DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(e.getDataContext());
        final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
        if (debugProcess == null) {
            return;
        }
        debugProcess.getSession().setSteppingThrough(stackFrame.getStackFrameProxy().threadProxy());
        if (evaluateFinallyBlocks(project, UIUtil.removeMnemonic(ActionsBundle.actionText(DebuggerActions.POP_FRAME)), stackFrame, new XDebuggerEvaluator.XEvaluationCallback() {

            @Override
            public void evaluated(@NotNull XValue result) {
                popFrame(debugProcess, debuggerContext, stackFrame);
            }

            @Override
            public void errorOccurred(@NotNull final String errorMessage) {
                ApplicationManager.getApplication().invokeLater(() -> Messages.showMessageDialog(project, DebuggerBundle.message("error.executing.finally", errorMessage), UIUtil.removeMnemonic(ActionsBundle.actionText(DebuggerActions.POP_FRAME)), Messages.getErrorIcon()));
            }
        }))
            return;
        popFrame(debugProcess, debuggerContext, stackFrame);
    } catch (NativeMethodException e2) {
        Messages.showMessageDialog(project, DebuggerBundle.message("error.native.method.exception"), UIUtil.removeMnemonic(ActionsBundle.actionText(DebuggerActions.POP_FRAME)), Messages.getErrorIcon());
    } catch (InvalidStackFrameException | VMDisconnectedException ignored) {
    }
}
Also used : NativeMethodException(com.sun.jdi.NativeMethodException) XDebuggerEvaluator(com.intellij.xdebugger.evaluation.XDebuggerEvaluator) InvalidStackFrameException(com.sun.jdi.InvalidStackFrameException) XValue(com.intellij.xdebugger.frame.XValue) VMDisconnectedException(com.sun.jdi.VMDisconnectedException) Project(com.intellij.openapi.project.Project) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) JavaStackFrame(com.intellij.debugger.engine.JavaStackFrame) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl)

Example 3 with InvalidStackFrameException

use of com.sun.jdi.InvalidStackFrameException in project che by eclipse.

the class JdiStackFrameImpl method getLocalVariables.

@Override
public JdiLocalVariable[] getLocalVariables() throws DebuggerException {
    if (localVariables == null) {
        try {
            List<LocalVariable> targetVariables = stackFrame.visibleVariables();
            localVariables = new JdiLocalVariable[targetVariables.size()];
            int i = 0;
            for (LocalVariable var : targetVariables) {
                localVariables[i++] = new JdiLocalVariableImpl(stackFrame, var);
            }
        } catch (AbsentInformationException e) {
            throw new DebuggerAbsentInformationException(e.getMessage(), e);
        } catch (InvalidStackFrameException | NativeMethodException e) {
            throw new DebuggerException(e.getMessage(), e);
        }
    }
    return localVariables;
}
Also used : NativeMethodException(com.sun.jdi.NativeMethodException) AbsentInformationException(com.sun.jdi.AbsentInformationException) DebuggerAbsentInformationException(org.eclipse.che.plugin.jdb.server.exceptions.DebuggerAbsentInformationException) DebuggerException(org.eclipse.che.api.debugger.server.exceptions.DebuggerException) LocalVariable(com.sun.jdi.LocalVariable) InvalidStackFrameException(com.sun.jdi.InvalidStackFrameException) DebuggerAbsentInformationException(org.eclipse.che.plugin.jdb.server.exceptions.DebuggerAbsentInformationException)

Example 4 with InvalidStackFrameException

use of com.sun.jdi.InvalidStackFrameException in project che by eclipse.

the class Evaluator method getLocalVariable.

public ExpressionValue getLocalVariable(String text) {
    ExpressionValue value = null;
    try {
        StackFrame frame = thread.frame(0);
        LocalVariable var = frame.visibleVariableByName(text);
        if (var != null) {
            value = new LocalValue(thread, var);
        }
    } catch (IncompatibleThreadStateException | AbsentInformationException | InvalidStackFrameException | NativeMethodException e) {
        throw new ExpressionException(e.getMessage(), e);
    }
    LOG.debug("GET local variable {} {} ", text, value);
    return value;
}
Also used : NativeMethodException(com.sun.jdi.NativeMethodException) IncompatibleThreadStateException(com.sun.jdi.IncompatibleThreadStateException) AbsentInformationException(com.sun.jdi.AbsentInformationException) StackFrame(com.sun.jdi.StackFrame) LocalVariable(com.sun.jdi.LocalVariable) InvalidStackFrameException(com.sun.jdi.InvalidStackFrameException)

Example 5 with InvalidStackFrameException

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

the class NodeDescriptorImpl method updateRepresentationNoNotify.

protected void updateRepresentationNoNotify(EvaluationContextImpl context, DescriptorLabelListener labelListener) {
    try {
        try {
            myEvaluateException = null;
            myLabel = calcRepresentation(context, labelListener);
        } catch (InconsistentDebugInfoException e) {
            throw new EvaluateException(DebuggerBundle.message("error.inconsistent.debug.info"));
        } catch (InvalidStackFrameException e) {
            throw new EvaluateException(DebuggerBundle.message("error.invalid.stackframe"));
        } catch (VMDisconnectedException e) {
            throw e;
        } catch (RuntimeException e) {
            if (e.getCause() instanceof InterruptedException) {
                throw e;
            }
            LOG.error(e);
            throw new EvaluateException("Internal error, see logs for more details");
        }
    } catch (EvaluateException e) {
        setFailed(e);
    }
}
Also used : VMDisconnectedException(com.sun.jdi.VMDisconnectedException) EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException) InconsistentDebugInfoException(com.sun.jdi.InconsistentDebugInfoException) InvalidStackFrameException(com.sun.jdi.InvalidStackFrameException)

Aggregations

InvalidStackFrameException (com.sun.jdi.InvalidStackFrameException)5 NativeMethodException (com.sun.jdi.NativeMethodException)3 AbsentInformationException (com.sun.jdi.AbsentInformationException)2 LocalVariable (com.sun.jdi.LocalVariable)2 VMDisconnectedException (com.sun.jdi.VMDisconnectedException)2 DebuggerException (org.eclipse.che.api.debugger.server.exceptions.DebuggerException)2 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)1 JavaStackFrame (com.intellij.debugger.engine.JavaStackFrame)1 EvaluateException (com.intellij.debugger.engine.evaluation.EvaluateException)1 DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)1 Project (com.intellij.openapi.project.Project)1 XDebuggerEvaluator (com.intellij.xdebugger.evaluation.XDebuggerEvaluator)1 XValue (com.intellij.xdebugger.frame.XValue)1 Field (com.sun.jdi.Field)1 IncompatibleThreadStateException (com.sun.jdi.IncompatibleThreadStateException)1 InconsistentDebugInfoException (com.sun.jdi.InconsistentDebugInfoException)1 ObjectReference (com.sun.jdi.ObjectReference)1 ReferenceType (com.sun.jdi.ReferenceType)1 StackFrame (com.sun.jdi.StackFrame)1 DebuggerAbsentInformationException (org.eclipse.che.plugin.jdb.server.exceptions.DebuggerAbsentInformationException)1