com.intellij.xdebugger.XDebugSession Java Examples
The following examples show how to use
com.intellij.xdebugger.XDebugSession.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BlazeGoDebugRunner.java From intellij with Apache License 2.0 | 6 votes |
private RunContentDescriptor doExecute(ExecutionEnvironment environment, RunProfileState state) throws ExecutionException { if (!(state instanceof BlazeGoDummyDebugProfileState)) { return null; } BlazeGoDummyDebugProfileState blazeState = (BlazeGoDummyDebugProfileState) state; GoApplicationRunningState goState = blazeState.toNativeState(environment); ExecutionResult executionResult = goState.execute(environment.getExecutor(), this); return XDebuggerManager.getInstance(environment.getProject()) .startSession( environment, new XDebugProcessStarter() { @Override public XDebugProcess start(XDebugSession session) throws ExecutionException { RemoteVmConnection connection = new DlvRemoteVmConnection(true); XDebugProcess process = new DlvDebugProcess(session, connection, executionResult, true, false); connection.open(goState.getDebugAddress()); return process; } }) .getRunContentDescriptor(); }
Example #2
Source File: XVariablesViewBase.java From consulo with Apache License 2.0 | 6 votes |
@Override public void selectionChanged(final SelectionEvent e) { if (!XDebuggerSettingsManager.getInstance().getDataViewSettings().isValueTooltipAutoShowOnSelection() || myEditor.getCaretModel().getCaretCount() > 1) { return; } final String text = myEditor.getDocument().getText(e.getNewRange()); if (!StringUtil.isEmpty(text) && !(text.contains("exec(") || text.contains("++") || text.contains("--") || text.contains("="))) { final XDebugSession session = getSession(getTree()); if (session == null) return; XDebuggerEvaluator evaluator = myStackFrame.getEvaluator(); if (evaluator == null) return; TextRange range = e.getNewRange(); ExpressionInfo info = new ExpressionInfo(range); int offset = range.getStartOffset(); LogicalPosition pos = myEditor.offsetToLogicalPosition(offset); Point point = myEditor.logicalPositionToXY(pos); new XValueHint(myProject, myEditor, point, ValueHintType.MOUSE_OVER_HINT, info, evaluator, session).invokeHint(); } }
Example #3
Source File: WeaveDebuggerRunner.java From mule-intellij-plugins with Apache License 2.0 | 6 votes |
@Nullable protected RunContentDescriptor attachVirtualMachine(final RunProfileState state, final @NotNull ExecutionEnvironment env) throws ExecutionException { return XDebuggerManager.getInstance(env.getProject()).startSession(env, new XDebugProcessStarter() { @NotNull public XDebugProcess start(@NotNull XDebugSession session) throws ExecutionException { WeaveRunnerCommandLine weaveRunnerCommandLine = (WeaveRunnerCommandLine) state; final String weaveFile = weaveRunnerCommandLine.getModel().getWeaveFile(); final Project project = weaveRunnerCommandLine.getEnvironment().getProject(); final VirtualFile projectFile = project.getBaseDir(); final String path = project.getBasePath(); final String relativePath = weaveFile.substring(path.length()); final VirtualFile fileByRelativePath = projectFile.findFileByRelativePath(relativePath); final DebuggerClient localhost = new DebuggerClient(new WeaveDebuggerClientListener(session, fileByRelativePath), new TcpClientDebuggerProtocol("localhost", 6565)); final ExecutionResult result = state.execute(env.getExecutor(), WeaveDebuggerRunner.this); new DebuggerConnector(localhost).start(); return new WeaveDebugProcess(session, localhost, result); } }).getRunContentDescriptor(); }
Example #4
Source File: WeaveExecutionStack.java From mule-intellij-plugins with Apache License 2.0 | 6 votes |
protected WeaveExecutionStack(DebuggerClient client, OnFrameEvent onFrameEvent, String displayName, XDebugSession session, VirtualFile file) { super(displayName, AllIcons.Debugger.ThreadSuspended); final DebuggerFrame[] frames = onFrameEvent.frames(); this.frames = new ArrayList<>(); for (int i = 0; i < frames.length; i++) { final DebuggerFrame debuggerFrame = frames[i]; if (i == 0) { this.frames.add(new WeaveStackFrame(client, onFrameEvent.startPosition(), debuggerFrame, file)); } else { this.frames.add(new WeaveStackFrame(client, frames[i - 1].startPosition(), debuggerFrame, file)); } } }
Example #5
Source File: XDebuggerEvaluateActionHandler.java From consulo with Apache License 2.0 | 6 votes |
private static void showDialog(@Nonnull XDebugSession session, VirtualFile file, XDebuggerEditorsProvider editorsProvider, XStackFrame stackFrame, XDebuggerEvaluator evaluator, @Nonnull XExpression expression) { if (expression.getLanguage() == null) { Language language = null; if (stackFrame != null) { XSourcePosition position = stackFrame.getSourcePosition(); if (position != null) { language = LanguageUtil.getFileLanguage(position.getFile()); } } if (language == null && file != null) { language = LanguageUtil.getFileTypeLanguage(file.getFileType()); } expression = new XExpressionImpl(expression.getExpression(), language, expression.getCustomInfo(), expression.getMode()); } new XDebuggerEvaluationDialog(session, editorsProvider, evaluator, expression, stackFrame == null ? null : stackFrame.getSourcePosition()).show(); }
Example #6
Source File: XWatchesViewImpl.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull private XExpression[] getExpressions() { XDebuggerTree tree = getTree(); XDebugSession session = getSession(tree); XExpression[] expressions; if (session != null) { expressions = ((XDebugSessionImpl)session).getSessionData().getWatchExpressions(); } else { XDebuggerTreeNode root = tree.getRoot(); List<? extends WatchNode> current = root instanceof WatchesRootNode ? ((WatchesRootNode)tree.getRoot()).getWatchChildren() : Collections.emptyList(); List<XExpression> list = ContainerUtil.newArrayList(); for (WatchNode child : current) { list.add(child.getExpression()); } expressions = list.toArray(new XExpression[list.size()]); } return expressions; }
Example #7
Source File: XValueHint.java From consulo with Apache License 2.0 | 6 votes |
public XValueHint(@Nonnull Project project, @Nonnull Editor editor, @Nonnull Point point, @Nonnull ValueHintType type, @Nonnull ExpressionInfo expressionInfo, @Nonnull XDebuggerEvaluator evaluator, @Nonnull XDebugSession session) { super(project, editor, point, type, expressionInfo.getTextRange()); myEvaluator = evaluator; myDebugSession = session; myExpression = XDebuggerEvaluateActionHandler.getExpressionText(expressionInfo, editor.getDocument()); myValueName = XDebuggerEvaluateActionHandler.getDisplayText(expressionInfo, editor.getDocument()); myExpressionInfo = expressionInfo; VirtualFile file; ConsoleView consoleView = ConsoleViewImpl.CONSOLE_VIEW_IN_EDITOR_VIEW.get(editor); if (consoleView instanceof LanguageConsoleView) { LanguageConsoleView console = ((LanguageConsoleView)consoleView); file = console.getHistoryViewer() == editor ? console.getVirtualFile() : null; } else { file = FileDocumentManager.getInstance().getFile(editor.getDocument()); } myExpressionPosition = file != null ? XDebuggerUtil.getInstance().createPositionByOffset(file, expressionInfo.getTextRange().getStartOffset()) : null; }
Example #8
Source File: FlutterPopFrameAction.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Nullable private static DartVmServiceStackFrame getStackFrame(@NotNull final AnActionEvent e) { final Project project = e.getProject(); if (project == null) return null; XDebugSession session = e.getData(XDebugSession.DATA_KEY); if (session == null) { session = XDebuggerManager.getInstance(project).getCurrentSession(); } if (session != null) { final XStackFrame frame = session.getCurrentStackFrame(); if (frame instanceof DartVmServiceStackFrame) { return ((DartVmServiceStackFrame)frame); } } return null; }
Example #9
Source File: CppBaseDebugRunner.java From CppTools with Apache License 2.0 | 6 votes |
@Nullable @Override protected RunContentDescriptor doExecute(Project project, RunProfileState runProfileState, RunContentDescriptor runContentDescriptor, ExecutionEnvironment env) throws ExecutionException { FileDocumentManager.getInstance().saveAllDocuments(); final RunProfile runProfile = env.getRunProfile(); final XDebugSession debugSession = XDebuggerManager.getInstance(project).startSession(this, env, runContentDescriptor, new XDebugProcessStarter() { @NotNull public XDebugProcess start(@NotNull final XDebugSession session) { return new CppDebugProcess(session, CppBaseDebugRunner.this, (BaseCppConfiguration)runProfile); } }); return debugSession.getRunContentDescriptor(); }
Example #10
Source File: XWatchesViewImpl.java From consulo with Apache License 2.0 | 6 votes |
public void updateSessionData() { List<XExpression> watchExpressions = ContainerUtil.newArrayList(); List<? extends WatchNode> children = myRootNode.getWatchChildren(); for (WatchNode child : children) { watchExpressions.add(child.getExpression()); } XDebugSession session = getSession(getTree()); XExpression[] expressions = watchExpressions.toArray(new XExpression[watchExpressions.size()]); if (session != null) { ((XDebugSessionImpl)session).setWatchExpressions(expressions); } else { XDebugSessionData data = getData(XDebugSessionData.DATA_KEY, getTree()); if (data != null) { data.setWatchExpressions(expressions); } } }
Example #11
Source File: FlutterPopFrameAction.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Nullable private static DartVmServiceStackFrame getStackFrame(@NotNull final AnActionEvent e) { final Project project = e.getProject(); if (project == null) return null; XDebugSession session = e.getData(XDebugSession.DATA_KEY); if (session == null) { session = XDebuggerManager.getInstance(project).getCurrentSession(); } if (session != null) { final XStackFrame frame = session.getCurrentStackFrame(); if (frame instanceof DartVmServiceStackFrame) { return ((DartVmServiceStackFrame)frame); } } return null; }
Example #12
Source File: XAddToWatchesFromEditorActionHandler.java From consulo with Apache License 2.0 | 6 votes |
@Nullable protected static String getTextToEvaluate(DataContext dataContext, XDebugSession session) { final Editor editor = dataContext.getData(CommonDataKeys.EDITOR); if (editor == null) { return null; } String text = editor.getSelectionModel().getSelectedText(); if (text == null) { XDebuggerEvaluator evaluator = session.getDebugProcess().getEvaluator(); if (evaluator != null) { text = XDebuggerEvaluateActionHandler.getExpressionText(evaluator, editor.getProject(), editor); } } return StringUtil.nullize(text, true); }
Example #13
Source File: MuleDebugProcess.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
public MuleDebugProcess(@NotNull final XDebugSession session, @NotNull final MuleDebuggerSession muleDebuggerSession, ExecutionResult result, Map<String, String> modulesToAppsMap) { super(session); this.muleDebuggerSession = muleDebuggerSession; this.muleBreakpointHandler = new MuleBreakpointHandler(muleDebuggerSession, modulesToAppsMap); this.editorProperties = new MuleDebuggerEditorProperties(); this.processHandler = result.getProcessHandler(); this.executionConsole = result.getExecutionConsole(); init(); }
Example #14
Source File: XWatchesViewImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override public void addWatchExpression(@Nonnull XExpression expression, int index, final boolean navigateToWatchNode) { XDebugSession session = getSession(getTree()); myRootNode.addWatchExpression(session != null ? session.getCurrentStackFrame() : null, expression, index, navigateToWatchNode); updateSessionData(); if (navigateToWatchNode && session != null) { XDebugSessionTab.showWatchesView((XDebugSessionImpl)session); } }
Example #15
Source File: ShowLibraryFramesAction.java From consulo with Apache License 2.0 | 5 votes |
@Override public void update(@Nonnull final AnActionEvent e) { super.update(e); Presentation presentation = e.getPresentation(); Object isSupported = presentation.getClientProperty(IS_LIBRARY_FRAME_FILTER_SUPPORTED); XDebugSession session = e.getData(XDebugSession.DATA_KEY); if (isSupported == null) { if (session == null) { // if session is null and isSupported is null - just return, it means that action created initially not in the xdebugger tab presentation.setVisible(false); return; } isSupported = session.getDebugProcess().isLibraryFrameFilterSupported(); presentation.putClientProperty(IS_LIBRARY_FRAME_FILTER_SUPPORTED, isSupported); } if (Boolean.TRUE.equals(isSupported)) { presentation.setVisible(true); final boolean shouldShow = !Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_PROPERTY)); presentation.setText(shouldShow ? ourTextWhenShowIsOn : ourTextWhenShowIsOff); } else { presentation.setVisible(false); } }
Example #16
Source File: XDebugView.java From consulo with Apache License 2.0 | 5 votes |
@Nullable protected VirtualFile getCurrentFile(@Nonnull Component component) { XDebugSession session = getSession(component); if (session != null) { XSourcePosition position = session.getCurrentPosition(); if (position != null) { return position.getFile(); } } return null; }
Example #17
Source File: XQuickEvaluateHandler.java From consulo with Apache License 2.0 | 5 votes |
@Override public AbstractValueHint createValueHint(@Nonnull final Project project, @Nonnull final Editor editor, @Nonnull final Point point, final ValueHintType type) { final XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession(); if (session == null) { return null; } final XDebuggerEvaluator evaluator = session.getDebugProcess().getEvaluator(); if (evaluator == null) { return null; } return PsiDocumentManager.getInstance(project).commitAndRunReadAction(new Computable<XValueHint>() { @Override public XValueHint compute() { int offset = AbstractValueHint.calculateOffset(editor, point); ExpressionInfo expressionInfo = getExpressionInfo(evaluator, project, type, editor, offset); if (expressionInfo == null) { return null; } int textLength = editor.getDocument().getTextLength(); TextRange range = expressionInfo.getTextRange(); if (range.getStartOffset() > range.getEndOffset() || range.getStartOffset() < 0 || range.getEndOffset() > textLength) { LOG.error("invalid range: " + range + ", text length = " + textLength + ", evaluator: " + evaluator); return null; } return new XValueHint(project, editor, point, type, expressionInfo, evaluator, session); } }); }
Example #18
Source File: XDebuggerEditorLinePainter.java From consulo with Apache License 2.0 | 5 votes |
private static int getCurrentBreakPointLineInFile(@Nullable XDebugSession session, VirtualFile file) { try { if (session != null) { final XSourcePosition position = session.getCurrentPosition(); if (position != null && position.getFile().equals(file)) { return position.getLine(); } } } catch (Exception ignore) { } return -1; }
Example #19
Source File: XQueryBreakpointHandler.java From intellij-xquery with Apache License 2.0 | 5 votes |
private boolean handleInvalidLine(XLineBreakpoint<XBreakpointProperties> breakpoint, int lineNumber) { if (lineNumber == -1) { final XDebugSession session = debugProcess.getSession(); session.updateBreakpointPresentation(breakpoint, AllIcons.Debugger.Db_invalid_breakpoint, "Unsupported breakpoint position"); return true; } return false; }
Example #20
Source File: SkylarkDebugProcess.java From intellij with Apache License 2.0 | 5 votes |
public SkylarkDebugProcess(XDebugSession session, ExecutionResult executionResult, int port) { super(session); this.project = session.getProject(); this.executionResult = executionResult; this.transport = new DebugClientTransport(this, port); session.setPauseActionSupported(true); }
Example #21
Source File: ResumeAction.java From consulo with Apache License 2.0 | 5 votes |
@Override protected boolean isEnabled(AnActionEvent e) { Project project = e.getProject(); if (project == null) return false; XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession(); if (session != null && !session.isStopped()) { return session.isPaused(); } return !ActionPlaces.DEBUGGER_TOOLBAR.equals(e.getPlace()); }
Example #22
Source File: XAddToWatchesFromEditorActionHandler.java From consulo with Apache License 2.0 | 5 votes |
@Override protected void perform(@Nonnull XDebugSession session, DataContext dataContext) { final String text = getTextToEvaluate(dataContext, session); if (text == null) return; ((XDebugSessionImpl)session).getSessionTab().getWatchesView().addWatchExpression(XExpressionImpl.fromText(text), -1, true); }
Example #23
Source File: XDebuggerSmartStepIntoHandler.java From consulo with Apache License 2.0 | 5 votes |
@Override protected void perform(@Nonnull XDebugSession session, DataContext dataContext) { XSmartStepIntoHandler<?> handler = session.getDebugProcess().getSmartStepIntoHandler(); XSourcePosition position = session.getTopFramePosition(); if (position == null || handler == null) return; FileEditor editor = FileEditorManager.getInstance(session.getProject()).getSelectedEditor(position.getFile()); if (editor instanceof TextEditor) { doSmartStepInto(handler, position, session, ((TextEditor)editor).getEditor()); } }
Example #24
Source File: XDebuggerSmartStepIntoHandler.java From consulo with Apache License 2.0 | 5 votes |
private static <V extends XSmartStepIntoVariant> void doSmartStepInto(final XSmartStepIntoHandler<V> handler, XSourcePosition position, final XDebugSession session, Editor editor) { List<V> variants = handler.computeSmartStepVariants(position); if (variants.isEmpty()) { session.stepInto(); return; } else if (variants.size() == 1) { session.smartStepInto(handler, variants.get(0)); return; } ListPopup popup = JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<V>(handler.getPopupTitle(position), variants) { @Override public Icon getIconFor(V aValue) { return TargetAWT.to(aValue.getIcon()); } @Nonnull @Override public String getTextFor(V value) { return value.getText(); } @Override public PopupStep onChosen(V selectedValue, boolean finalChoice) { session.smartStepInto(handler, selectedValue); return FINAL_CHOICE; } }); DebuggerUIUtil.showPopupForEditorLine(popup, editor, position.getLine()); }
Example #25
Source File: XVariablesView.java From consulo with Apache License 2.0 | 5 votes |
protected void addEmptyMessage(XValueContainerNode root) { XDebugSession session = getSession(getPanel()); if (session != null) { if (!session.isStopped() && session.isPaused()) { root.setInfoMessage("Frame is not available", null); } else { XDebugProcess debugProcess = session.getDebugProcess(); root.setInfoMessage(debugProcess.getCurrentStateMessage(), debugProcess.getCurrentStateHyperlinkListener()); } } }
Example #26
Source File: XDebuggerTreeInplaceEditor.java From consulo with Apache License 2.0 | 5 votes |
@Override protected void onShown() { XDebugSession session = XDebugView.getSession(myTree); if (session != null) { session.addSessionListener(new XDebugSessionListener() { @Override public void sessionPaused() { cancel(); } @Override public void sessionResumed() { cancel(); } @Override public void sessionStopped() { cancel(); } @Override public void stackFrameChanged() { cancel(); } @Override public void beforeSessionResume() { cancel(); } private void cancel() { AppUIUtil.invokeOnEdt(XDebuggerTreeInplaceEditor.this::cancelEditing); } }, myDisposable); } }
Example #27
Source File: XAddToWatchesTreeAction.java From consulo with Apache License 2.0 | 5 votes |
private static XWatchesView getWatchesView(@Nonnull AnActionEvent e) { XWatchesView view = e.getData(XWatchesView.DATA_KEY); Project project = e.getProject(); if (view == null && project != null) { XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession(); if (session != null) { XDebugSessionTab tab = ((XDebugSessionImpl)session).getSessionTab(); if (tab != null) { return tab.getWatchesView(); } } } return view; }
Example #28
Source File: SortValuesToggleAction.java From consulo with Apache License 2.0 | 5 votes |
@RequiredUIAccess @Override public void update(@Nonnull AnActionEvent e) { super.update(e); XDebugSession session = e.getDataContext().getData(XDebugSession.DATA_KEY); e.getPresentation().setEnabledAndVisible(session != null && !session.getDebugProcess().isValuesCustomSorted()); }
Example #29
Source File: XValueNodeImpl.java From consulo with Apache License 2.0 | 5 votes |
public void updateInlineDebuggerData() { try { XDebugSession session = XDebugView.getSession(getTree()); final XSourcePosition debuggerPosition = session == null ? null : session.getCurrentPosition(); if (debuggerPosition == null) { return; } final XInlineDebuggerDataCallback callback = new XInlineDebuggerDataCallback() { @Override public void computed(XSourcePosition position) { if (isObsolete() || position == null) return; VirtualFile file = position.getFile(); // filter out values from other files if (!Comparing.equal(debuggerPosition.getFile(), file)) { return; } final Document document = FileDocumentManager.getInstance().getDocument(file); if (document == null) return; XVariablesView.InlineVariablesInfo data = myTree.getProject().getUserData(XVariablesView.DEBUG_VARIABLES); if (data == null) { return; } if (!showAsInlay(file, position, debuggerPosition)) { data.put(file, position, XValueNodeImpl.this, document.getModificationStamp()); myTree.updateEditor(); } } }; if (getValueContainer().computeInlineDebuggerData(callback) == ThreeState.UNSURE) { getValueContainer().computeSourcePosition(callback::computed); } } catch (Exception ignore) { } }
Example #30
Source File: XFramesView.java From consulo with Apache License 2.0 | 5 votes |
private void updateFrames(XExecutionStack executionStack, @Nonnull XDebugSession session, @Nullable XStackFrame frameToSelect) { if (mySelectedStack != null) { getOrCreateBuilder(mySelectedStack, session).stop(); } mySelectedStack = executionStack; if (executionStack != null) { mySelectedFrameIndex = myExecutionStacksWithSelection.get(executionStack); StackFramesListBuilder builder = getOrCreateBuilder(executionStack, session); builder.setToSelect(frameToSelect != null ? frameToSelect : mySelectedFrameIndex); myListenersEnabled = false; builder.initModel(myFramesList.getModel()); myListenersEnabled = !builder.start(); } }