use of com.sun.jdi.VMDisconnectedException in project intellij-community by JetBrains.
the class RequestHint method getNextStepDepth.
public int getNextStepDepth(final SuspendContextImpl context) {
try {
final StackFrameProxyImpl frameProxy = context.getFrameProxy();
// smart step feature stop check
if (myMethodFilter != null && frameProxy != null && !(myMethodFilter instanceof BreakpointStepMethodFilter) && myMethodFilter.locationMatches(context.getDebugProcess(), frameProxy.location()) && !isTheSameFrame(context)) {
myTargetMethodMatched = true;
return myMethodFilter.onReached(context, this);
}
if ((myDepth == StepRequest.STEP_OVER || myDepth == StepRequest.STEP_INTO) && myPosition != null) {
SourcePosition locationPosition = ContextUtil.getSourcePosition(context);
if (locationPosition != null) {
Integer resultDepth = ApplicationManager.getApplication().runReadAction(new Computable<Integer>() {
public Integer compute() {
if (myPosition.getFile().equals(locationPosition.getFile()) && isTheSameFrame(context) && !mySteppedOut) {
return isOnTheSameLine(locationPosition) ? myDepth : STOP;
}
return null;
}
});
if (resultDepth != null) {
return resultDepth.intValue();
}
}
}
// Now check filters
final DebuggerSettings settings = DebuggerSettings.getInstance();
if ((myMethodFilter != null || (settings.SKIP_SYNTHETIC_METHODS && !myIgnoreFilters)) && frameProxy != null) {
final Location location = frameProxy.location();
if (location != null) {
if (DebuggerUtils.isSynthetic(location.method())) {
return myDepth;
}
}
}
if (!myIgnoreFilters) {
if (settings.SKIP_GETTERS) {
boolean isGetter = ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
public Boolean compute() {
PsiElement contextElement = ContextUtil.getContextElement(context);
return contextElement != null && DebuggerUtils.isInsideSimpleGetter(contextElement);
}
}).booleanValue();
if (isGetter) {
return StepRequest.STEP_OUT;
}
}
if (frameProxy != null) {
if (settings.SKIP_CONSTRUCTORS) {
final Location location = frameProxy.location();
if (location != null) {
final Method method = location.method();
if (method != null && method.isConstructor()) {
return StepRequest.STEP_OUT;
}
}
}
if (settings.SKIP_CLASSLOADERS) {
final Location location = frameProxy.location();
if (location != null && DebuggerUtilsEx.isAssignableFrom("java.lang.ClassLoader", location.declaringType())) {
return StepRequest.STEP_OUT;
}
}
}
for (ExtraSteppingFilter filter : ExtraSteppingFilter.EP_NAME.getExtensions()) {
try {
if (filter.isApplicable(context))
return filter.getStepRequestDepth(context);
} catch (Exception | AssertionError e) {
LOG.error(e);
}
}
}
// smart step feature
if (myMethodFilter != null && !mySteppedOut) {
return StepRequest.STEP_OUT;
}
} catch (VMDisconnectedException ignored) {
} catch (EvaluateException e) {
LOG.error(e);
}
return STOP;
}
use of com.sun.jdi.VMDisconnectedException in project intellij-community by JetBrains.
the class ConnectionServiceWrapper method createVirtualMachine.
public VirtualMachine createVirtualMachine() throws IOException {
try {
final VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager();
//noinspection HardCodedStringLiteral
final Method method = virtualMachineManager.getClass().getMethod("createVirtualMachine", new Class[] { myDelegateClass });
return (VirtualMachine) method.invoke(virtualMachineManager, new Object[] { myConnection });
} catch (NoSuchMethodException | IllegalAccessException e) {
LOG.error(e);
} catch (InvocationTargetException e) {
final Throwable cause = e.getCause();
if (cause instanceof IOException) {
throw (IOException) cause;
}
if (cause instanceof VMDisconnectedException) {
// ignore this one
return null;
}
LOG.error(e);
}
return null;
}
use of com.sun.jdi.VMDisconnectedException 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) {
}
}
use of com.sun.jdi.VMDisconnectedException 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);
}
}
Aggregations