use of com.intellij.xdebugger.frame.XStackFrame in project intellij-plugins by JetBrains.
the class DartVmServiceListener method onIsolatePaused.
void onIsolatePaused(@NotNull final IsolateRef isolateRef, @Nullable final ElementList<Breakpoint> vmBreakpoints, @Nullable final InstanceRef exception, @Nullable final Frame vmTopFrame, boolean atAsyncSuspension) {
if (vmTopFrame == null) {
myDebugProcess.getSession().positionReached(new XSuspendContext() {
});
return;
}
final DartVmServiceSuspendContext suspendContext = new DartVmServiceSuspendContext(myDebugProcess, isolateRef, vmTopFrame, exception, atAsyncSuspension);
final XStackFrame xTopFrame = suspendContext.getActiveExecutionStack().getTopFrame();
final XSourcePosition sourcePosition = xTopFrame == null ? null : xTopFrame.getSourcePosition();
if (vmBreakpoints == null || vmBreakpoints.isEmpty()) {
final StepOption latestStep = myDebugProcess.getVmServiceWrapper().getLatestStep();
if (latestStep == StepOption.Over && equalSourcePositions(myLatestSourcePosition, sourcePosition)) {
// continue stepping to change current line
myDebugProcess.getVmServiceWrapper().resumeIsolate(isolateRef.getId(), latestStep);
} else {
myLatestSourcePosition = sourcePosition;
myDebugProcess.getSession().positionReached(suspendContext);
}
} else {
if (vmBreakpoints.size() > 1) {
// Shouldn't happen. IDE doesn't allow to set 2 breakpoints on one line.
LOG.error(vmBreakpoints.size() + " breakpoints hit in one shot.");
}
// Remove any temporary (run to cursor) breakpoints.
myBreakpointHandler.removeTemporaryBreakpoints(isolateRef.getId());
final XLineBreakpoint<XBreakpointProperties> xBreakpoint = myBreakpointHandler.getXBreakpoint(vmBreakpoints.get(0));
if (xBreakpoint == null) {
// breakpoint could be set in the Observatory
myLatestSourcePosition = sourcePosition;
myDebugProcess.getSession().positionReached(suspendContext);
return;
}
if ("false".equals(evaluateExpression(isolateRef.getId(), vmTopFrame, xBreakpoint.getConditionExpression()))) {
myDebugProcess.getVmServiceWrapper().resumeIsolate(isolateRef.getId(), null);
return;
}
myLatestSourcePosition = sourcePosition;
final String logExpression = evaluateExpression(isolateRef.getId(), vmTopFrame, xBreakpoint.getLogExpressionObject());
final boolean suspend = myDebugProcess.getSession().breakpointReached(xBreakpoint, logExpression, suspendContext);
if (!suspend) {
myDebugProcess.getVmServiceWrapper().resumeIsolate(isolateRef.getId(), null);
}
}
}
use of com.intellij.xdebugger.frame.XStackFrame in project intellij-community by JetBrains.
the class XDebuggerEvaluateActionHandler method perform.
@Override
protected void perform(@NotNull final XDebugSession session, final DataContext dataContext) {
final XDebuggerEditorsProvider editorsProvider = session.getDebugProcess().getEditorsProvider();
final XStackFrame stackFrame = session.getCurrentStackFrame();
final XDebuggerEvaluator evaluator = session.getDebugProcess().getEvaluator();
if (evaluator == null) {
return;
}
Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
EvaluationMode mode = EvaluationMode.EXPRESSION;
String selectedText = editor != null ? editor.getSelectionModel().getSelectedText() : null;
if (selectedText != null) {
selectedText = evaluator.formatTextForEvaluation(selectedText);
mode = evaluator.getEvaluationMode(selectedText, editor.getSelectionModel().getSelectionStart(), editor.getSelectionModel().getSelectionEnd(), CommonDataKeys.PSI_FILE.getData(dataContext));
}
Promise<String> expressionTextPromise = Promise.resolve(selectedText);
if (selectedText == null && editor != null) {
expressionTextPromise = getExpressionText(evaluator, CommonDataKeys.PROJECT.getData(dataContext), editor);
}
final VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(dataContext);
EvaluationMode finalMode = mode;
XValue value = XDebuggerTreeActionBase.getSelectedValue(dataContext);
expressionTextPromise.done(expressionText -> {
if (expressionText == null && value != null) {
value.calculateEvaluationExpression().done(expression -> {
if (expression != null) {
AppUIUtil.invokeOnEdt(() -> showDialog(session, file, editorsProvider, stackFrame, evaluator, expression));
}
});
} else {
XExpression expression = XExpressionImpl.fromText(StringUtil.notNullize(expressionText), finalMode);
AppUIUtil.invokeOnEdt(() -> showDialog(session, file, editorsProvider, stackFrame, evaluator, expression));
}
});
}
use of com.intellij.xdebugger.frame.XStackFrame in project intellij-community by JetBrains.
the class XDebugSessionImpl method showExecutionPoint.
@Override
public void showExecutionPoint() {
if (mySuspendContext != null) {
XExecutionStack executionStack = mySuspendContext.getActiveExecutionStack();
if (executionStack != null) {
XStackFrame topFrame = executionStack.getTopFrame();
if (topFrame != null) {
setCurrentStackFrame(executionStack, topFrame, true);
myDebuggerManager.showExecutionPosition();
}
}
}
}
use of com.intellij.xdebugger.frame.XStackFrame in project intellij-community by JetBrains.
the class XVariablesView method processSessionEvent.
@Override
public void processSessionEvent(@NotNull SessionEvent event, @NotNull XDebugSession session) {
if (ApplicationManager.getApplication().isDispatchThread()) {
// mark nodes obsolete asap
getTree().markNodesObsolete();
}
XStackFrame stackFrame = session.getCurrentStackFrame();
DebuggerUIUtil.invokeLater(() -> {
XDebuggerTree tree = getTree();
if (event == SessionEvent.BEFORE_RESUME || event == SessionEvent.SETTINGS_CHANGED) {
saveCurrentTreeState(stackFrame);
if (event == SessionEvent.BEFORE_RESUME) {
return;
}
}
tree.markNodesObsolete();
if (stackFrame != null) {
cancelClear();
buildTreeAndRestoreState(stackFrame);
} else {
requestClear();
}
});
}
Aggregations