use of com.intellij.debugger.engine.DebugProcessImpl in project intellij-community by JetBrains.
the class ForceEarlyReturnAction method actionPerformed.
public void actionPerformed(@NotNull AnActionEvent e) {
final Project project = e.getProject();
final JavaStackFrame stackFrame = PopFrameAction.getStackFrame(e);
if (stackFrame == null || project == null) {
return;
}
final DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(e.getDataContext());
final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
if (debugProcess == null) {
return;
}
final StackFrameProxyImpl proxy = stackFrame.getStackFrameProxy();
final ThreadReferenceProxyImpl thread = proxy.threadProxy();
debugProcess.getManagerThread().schedule(new DebuggerContextCommandImpl(debuggerContext, thread) {
@Override
public void threadAction() {
Method method;
try {
method = proxy.location().method();
} catch (EvaluateException e) {
showError(project, DebuggerBundle.message("error.early.return", e.getLocalizedMessage()));
return;
}
if ("void".equals(method.returnTypeName())) {
forceEarlyReturnWithFinally(thread.getVirtualMachine().mirrorOfVoid(), stackFrame, debugProcess, null);
} else {
ApplicationManager.getApplication().invokeLater(() -> new ReturnExpressionDialog(project, debugProcess.getXdebugProcess().getEditorsProvider(), debugProcess, stackFrame).show());
}
}
});
}
use of com.intellij.debugger.engine.DebugProcessImpl in project intellij-community by JetBrains.
the class FreezeThreadAction method update.
public void update(AnActionEvent e) {
DebuggerTreeNodeImpl[] selectedNode = getSelectedNodes(e.getDataContext());
if (selectedNode == null) {
return;
}
DebugProcessImpl debugProcess = getDebuggerContext(e.getDataContext()).getDebugProcess();
boolean visible = false;
if (debugProcess != null) {
visible = true;
for (DebuggerTreeNodeImpl aSelectedNode : selectedNode) {
NodeDescriptorImpl threadDescriptor = aSelectedNode.getDescriptor();
if (!(threadDescriptor instanceof ThreadDescriptorImpl) || ((ThreadDescriptorImpl) threadDescriptor).isSuspended()) {
visible = false;
break;
}
}
}
e.getPresentation().setVisible(visible);
}
use of com.intellij.debugger.engine.DebugProcessImpl in project intellij-community by JetBrains.
the class FreezeThreadAction method actionPerformed.
public void actionPerformed(final AnActionEvent e) {
DebuggerTreeNodeImpl[] selectedNode = getSelectedNodes(e.getDataContext());
if (selectedNode == null) {
return;
}
final DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
for (final DebuggerTreeNodeImpl debuggerTreeNode : selectedNode) {
ThreadDescriptorImpl threadDescriptor = ((ThreadDescriptorImpl) debuggerTreeNode.getDescriptor());
final ThreadReferenceProxyImpl thread = threadDescriptor.getThreadReference();
if (!threadDescriptor.isFrozen()) {
debugProcess.getManagerThread().schedule(new DebuggerCommandImpl() {
@Override
protected void action() throws Exception {
debugProcess.createFreezeThreadCommand(thread).run();
debuggerTreeNode.calcValue();
}
});
}
}
}
use of com.intellij.debugger.engine.DebugProcessImpl in project intellij-community by JetBrains.
the class ClassObjectRenderer method getFullValueEvaluator.
@Nullable
@Override
public XFullValueEvaluator getFullValueEvaluator(final EvaluationContextImpl evaluationContext, final ValueDescriptorImpl valueDescriptor) {
return new JavaValue.JavaFullValueEvaluator(DebuggerBundle.message("message.node.navigate"), evaluationContext) {
@Override
public void evaluate(@NotNull XFullValueEvaluationCallback callback) {
Value value = valueDescriptor.getValue();
ClassType type = ((ClassType) value.type());
Method nameMethod = type.concreteMethodByName("getName", "()Ljava/lang/String;");
if (nameMethod != null) {
try {
final DebugProcessImpl process = evaluationContext.getDebugProcess();
Value res = process.invokeMethod(evaluationContext, (ObjectReference) value, nameMethod, Collections.emptyList());
if (res instanceof StringReference) {
callback.evaluated("");
final String line = ((StringReference) res).value();
ApplicationManager.getApplication().runReadAction(() -> {
final PsiClass psiClass = DebuggerUtils.findClass(line, valueDescriptor.getProject(), process.getSearchScope());
if (psiClass != null) {
DebuggerUIUtil.invokeLater(() -> psiClass.navigate(true));
}
});
}
} catch (EvaluateException e) {
LOG.info("Exception while getting type name", e);
}
}
}
@Override
public boolean isShowValuePopup() {
return false;
}
};
}
use of com.intellij.debugger.engine.DebugProcessImpl 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) {
}
}
};
}
Aggregations