use of com.intellij.debugger.jdi.StackFrameProxyImpl in project intellij-community by JetBrains.
the class EvaluationDescriptor method calcValue.
public final Value calcValue(EvaluationContextImpl evaluationContext) throws EvaluateException {
try {
PsiDocumentManager.getInstance(myProject).commitAndRunReadAction(() -> {
});
EvaluationContextImpl thisEvaluationContext = getEvaluationContext(evaluationContext);
SourcePosition position = ContextUtil.getSourcePosition(evaluationContext);
PsiElement psiContext = ContextUtil.getContextElement(evaluationContext, position);
ExpressionEvaluator evaluator = ReadAction.compute(() -> {
PsiCodeFragment code = getEvaluationCode(thisEvaluationContext);
try {
return DebuggerUtilsEx.findAppropriateCodeFragmentFactory(getEvaluationText(), psiContext).getEvaluatorBuilder().build(code, position);
} catch (UnsupportedExpressionException ex) {
ExpressionEvaluator eval = CompilingEvaluatorImpl.create(myProject, code.getContext(), element -> code);
if (eval != null) {
return eval;
}
throw ex;
}
});
if (!thisEvaluationContext.getDebugProcess().isAttached()) {
throw EvaluateExceptionUtil.PROCESS_EXITED;
}
StackFrameProxyImpl frameProxy = thisEvaluationContext.getFrameProxy();
if (frameProxy == null) {
throw EvaluateExceptionUtil.NULL_STACK_FRAME;
}
Value value = evaluator.evaluate(thisEvaluationContext);
DebuggerUtilsEx.keep(value, thisEvaluationContext);
myModifier = evaluator.getModifier();
setLvalue(myModifier != null);
return value;
} catch (final EvaluateException ex) {
throw new EvaluateException(ex.getLocalizedMessage(), ex);
} catch (ObjectCollectedException ex) {
throw EvaluateExceptionUtil.OBJECT_WAS_COLLECTED;
}
}
use of com.intellij.debugger.jdi.StackFrameProxyImpl in project intellij-community by JetBrains.
the class ThreadsPanel method selectFrame.
private void selectFrame(DebuggerTreeNodeImpl node) {
StackFrameProxyImpl frame = ((StackFrameDescriptorImpl) node.getDescriptor()).getFrameProxy();
DebuggerContextUtil.setStackFrame(getContextManager(), frame);
}
use of com.intellij.debugger.jdi.StackFrameProxyImpl in project kotlin by JetBrains.
the class DebuggerSteppingHelper method createStepOutCommand.
public static DebugProcessImpl.ResumeCommand createStepOutCommand(final SuspendContextImpl suspendContext, final boolean ignoreBreakpoints, final List<KtNamedFunction> inlineFunctions, final KtFunctionLiteral inlineArgument) {
final DebugProcessImpl debugProcess = suspendContext.getDebugProcess();
return debugProcess.new ResumeCommand(suspendContext) {
@Override
public void contextAction() {
try {
StackFrameProxyImpl frameProxy = suspendContext.getFrameProxy();
if (frameProxy != null) {
Action action = KotlinSteppingCommandProviderKt.getStepOutAction(frameProxy.location(), suspendContext, inlineFunctions, inlineArgument);
createStepRequest(suspendContext, getContextThread(), debugProcess.getVirtualMachineProxy().eventRequestManager(), StepRequest.STEP_LINE, StepRequest.STEP_OUT);
action.apply(debugProcess, suspendContext, ignoreBreakpoints);
return;
}
debugProcess.createStepOverCommand(suspendContext, ignoreBreakpoints).contextAction();
} catch (EvaluateException ignored) {
}
}
};
}
use of com.intellij.debugger.jdi.StackFrameProxyImpl in project kotlin by JetBrains.
the class DebuggerSteppingHelper method getCurrentClassName.
// copied from DebugProcessImpl.getActiveFilters
@Nullable
private static String getCurrentClassName(ThreadReferenceProxyImpl thread) {
try {
if (thread != null && thread.frameCount() > 0) {
StackFrameProxyImpl stackFrame = thread.frame(0);
if (stackFrame != null) {
Location location = stackFrame.location();
ReferenceType referenceType = location == null ? null : location.declaringType();
if (referenceType != null) {
return referenceType.name();
}
}
}
} catch (EvaluateException ignored) {
}
return null;
}
use of com.intellij.debugger.jdi.StackFrameProxyImpl in project intellij-community by JetBrains.
the class SourceCodeChecker method checkSource.
public static void checkSource(DebuggerContextImpl debuggerContext) {
if (!Registry.is("debugger.check.source")) {
return;
}
SuspendContextImpl suspendContext = debuggerContext.getSuspendContext();
if (suspendContext == null) {
return;
}
suspendContext.getDebugProcess().getManagerThread().schedule(new SuspendContextCommandImpl(suspendContext) {
@Override
public Priority getPriority() {
return Priority.LOW;
}
@Override
public void contextAction() throws Exception {
try {
StackFrameProxyImpl frameProxy = debuggerContext.getFrameProxy();
if (frameProxy == null) {
return;
}
Location location = frameProxy.location();
check(location, debuggerContext.getSourcePosition(), suspendContext.getDebugProcess().getProject());
//checkAllClasses(debuggerContext);
} catch (EvaluateException e) {
LOG.info(e);
}
}
});
}
Aggregations