use of com.intellij.debugger.engine.DebugProcessImpl in project intellij-community by JetBrains.
the class BreakpointWithHighlighter method updateUI.
/**
* updates the state of breakpoint and all the related UI widgets etc
*/
@Override
public final void updateUI() {
if (!isVisible() || ApplicationManager.getApplication().isUnitTestMode()) {
return;
}
DebuggerInvocationUtil.swingInvokeLater(myProject, () -> {
if (!isValid()) {
return;
}
DebuggerContextImpl context = DebuggerManagerEx.getInstanceEx(myProject).getContext();
DebugProcessImpl debugProcess = context.getDebugProcess();
if (debugProcess == null || !debugProcess.isAttached()) {
updateCaches(null);
updateGutter();
} else {
debugProcess.getManagerThread().invoke(new DebuggerCommandImpl() {
@Override
protected void action() throws Exception {
ApplicationManager.getApplication().runReadAction(() -> {
if (!myProject.isDisposed()) {
updateCaches(debugProcess);
}
});
DebuggerInvocationUtil.swingInvokeLater(myProject, BreakpointWithHighlighter.this::updateGutter);
}
});
}
});
}
use of com.intellij.debugger.engine.DebugProcessImpl in project intellij-community by JetBrains.
the class JumpToAllocationSourceAction method perform.
@Override
protected void perform(XValueNodeImpl node, @NotNull String nodeName, AnActionEvent e) {
final Project project = e.getProject();
final List<StackFrameItem> stack = getStack(e);
if (project != null && stack != null) {
final XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
if (session != null) {
DebugProcessImpl process = (DebugProcessImpl) DebuggerManager.getInstance(project).getDebugProcess(session.getDebugProcess().getProcessHandler());
StackFramePopup.show(stack, process);
}
}
}
use of com.intellij.debugger.engine.DebugProcessImpl in project intellij-community by JetBrains.
the class GenericDebuggerRunner method attachVirtualMachine.
@Nullable
protected RunContentDescriptor attachVirtualMachine(RunProfileState state, @NotNull ExecutionEnvironment env, RemoteConnection connection, long pollTimeout) throws ExecutionException {
DebugEnvironment environment = new DefaultDebugEnvironment(env, state, connection, pollTimeout);
final DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(env.getProject()).attachVirtualMachine(environment);
if (debuggerSession == null) {
return null;
}
final DebugProcessImpl debugProcess = debuggerSession.getProcess();
return XDebuggerManager.getInstance(env.getProject()).startSession(env, new XDebugProcessStarter() {
@Override
@NotNull
public XDebugProcess start(@NotNull XDebugSession session) {
XDebugSessionImpl sessionImpl = (XDebugSessionImpl) session;
ExecutionResult executionResult = debugProcess.getExecutionResult();
sessionImpl.addExtraActions(executionResult.getActions());
if (executionResult instanceof DefaultExecutionResult) {
sessionImpl.addRestartActions(((DefaultExecutionResult) executionResult).getRestartActions());
}
return JavaDebugProcess.create(session, debuggerSession);
}
}).getRunContentDescriptor();
}
use of com.intellij.debugger.engine.DebugProcessImpl in project intellij-community by JetBrains.
the class BoxingEvaluator method convertToWrapper.
private static Value convertToWrapper(EvaluationContextImpl context, PrimitiveValue value, String wrapperTypeName) throws EvaluateException {
final DebugProcessImpl process = context.getDebugProcess();
final ClassType wrapperClass = (ClassType) process.findClass(context, wrapperTypeName, null);
final String methodSignature = "(" + JVMNameUtil.getPrimitiveSignature(value.type().name()) + ")L" + wrapperTypeName.replace('.', '/') + ";";
Method method = wrapperClass.concreteMethodByName("valueOf", methodSignature);
if (method == null) {
// older JDK version
method = wrapperClass.concreteMethodByName(JVMNameUtil.CONSTRUCTOR_NAME, methodSignature);
}
if (method == null) {
throw new EvaluateException("Cannot construct wrapper object for value of type " + value.type() + ": Unable to find either valueOf() or constructor method");
}
return process.invokeMethod(context, wrapperClass, method, Collections.singletonList(value));
}
use of com.intellij.debugger.engine.DebugProcessImpl in project intellij-community by JetBrains.
the class NewClassInstanceEvaluator method evaluate.
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
DebugProcessImpl debugProcess = context.getDebugProcess();
Object obj = myClassTypeEvaluator.evaluate(context);
if (!(obj instanceof ClassType)) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.evaluate.class.type"));
}
ClassType classType = (ClassType) obj;
// find constructor
Method method = DebuggerUtils.findMethod(classType, JVMNameUtil.CONSTRUCTOR_NAME, myConstructorSignature.getName(debugProcess));
if (method == null) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.resolve.constructor", myConstructorSignature.getDisplayName(debugProcess)));
}
// evaluate arguments
List<Value> arguments;
if (!ArrayUtil.isEmpty(myParamsEvaluators)) {
arguments = new ArrayList<>(myParamsEvaluators.length);
for (Evaluator evaluator : myParamsEvaluators) {
Object res = evaluator.evaluate(context);
if (!(res instanceof Value) && res != null) {
LOG.error("Unable to call newInstance, evaluator " + evaluator + " result is not Value, but " + res);
}
//noinspection ConstantConditions
arguments.add((Value) res);
}
} else {
arguments = Collections.emptyList();
}
ObjectReference objRef;
try {
objRef = debugProcess.newInstance(context, classType, method, arguments);
} catch (EvaluateException e) {
throw EvaluateExceptionUtil.createEvaluateException(e);
}
return objRef;
}
Aggregations