com.intellij.xdebugger.XDebugProcess Java Examples
The following examples show how to use
com.intellij.xdebugger.XDebugProcess.
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: 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 #2
Source File: XDebuggerManagerImpl.java From consulo with Apache License 2.0 | 6 votes |
private XDebugSessionImpl startSession(@Nullable RunContentDescriptor contentToReuse, @Nonnull XDebugProcessStarter processStarter, @Nonnull XDebugSessionImpl session) throws ExecutionException { XDebugProcess process = processStarter.start(session); myProject.getMessageBus().syncPublisher(TOPIC).processStarted(process); // Perform custom configuration of session data for XDebugProcessConfiguratorStarter classes if (processStarter instanceof XDebugProcessConfiguratorStarter) { session.activateSession(); ((XDebugProcessConfiguratorStarter)processStarter).configure(session.getSessionData()); } session.init(process, contentToReuse); mySessions.put(session.getDebugProcess().getProcessHandler(), session); return session; }
Example #3
Source File: XQueryDebuggerRunner.java From intellij-xquery with Apache License 2.0 | 6 votes |
private XDebugProcessStarter getProcessStarter(final RunProfileState runProfileState, final ExecutionEnvironment executionEnvironment) throws ExecutionException { int port = getAvailablePort(); ((XQueryRunProfileState) runProfileState).setPort(port); return new XDebugProcessStarter() { @NotNull public XDebugProcess start(@NotNull final XDebugSession session) throws ExecutionException { final ExecutionResult result = runProfileState.execute(executionEnvironment.getExecutor(), XQueryDebuggerRunner.this); XQueryDebugProcess.XQueryDebuggerIde debuggerIde = new XQueryDebugProcess.XQueryDebuggerIde(session, result.getProcessHandler()); final DBGpIde dbgpIde = ide().withPort(port).withDebuggerIde(debuggerIde).build(); dbgpIde.startListening(); result.getProcessHandler().addProcessListener(new ProcessAdapter() { @Override public void processTerminated(ProcessEvent event) { dbgpIde.stopListening(); } }); return new XQueryDebugProcess(session, result, dbgpIde); } }; }
Example #4
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 #5
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 #6
Source File: HaxeFlashDebuggingUtil.java From intellij-haxe with Apache License 2.0 | 5 votes |
public static RunContentDescriptor getDescriptor(final Module module, ExecutionEnvironment env, String urlToLaunch, String flexSdkName) throws ExecutionException { final Sdk flexSdk = FlexSdkUtils.findFlexOrFlexmojosSdk(flexSdkName); if (flexSdk == null) { throw new ExecutionException(HaxeBundle.message("flex.sdk.not.found", flexSdkName)); } final FlexBuildConfiguration bc = new FakeFlexBuildConfiguration(flexSdk, urlToLaunch); final XDebugSession debugSession = XDebuggerManager.getInstance(module.getProject()).startSession(env, new XDebugProcessStarter() { @NotNull public XDebugProcess start(@NotNull final XDebugSession session) throws ExecutionException { try { final FlashRunnerParameters params = new FlashRunnerParameters(); params.setModuleName(module.getName()); return new HaxeDebugProcess(session, bc, params); } catch (IOException e) { throw new ExecutionException(e.getMessage(), e); } } }); return debugSession.getRunContentDescriptor(); }
Example #7
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 #8
Source File: XDebuggerManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @Override public <T extends XDebugProcess> List<? extends T> getDebugProcesses(Class<T> processClass) { List<T> list = null; for (XDebugSessionImpl session : mySessions.values()) { final XDebugProcess process = session.getDebugProcess(); if (processClass.isInstance(process)) { if (list == null) { list = new SmartList<>(); } list.add(processClass.cast(process)); } } return ContainerUtil.notNullize(list); }
Example #9
Source File: HaxeFlashDebuggingUtil.java From intellij-haxe with Apache License 2.0 | 5 votes |
public static RunContentDescriptor getOpenFLDescriptor(final HaxeDebugRunner runner, final Module module, final ExecutionEnvironment env, final Executor executor, String flexSdkName) throws ExecutionException { final Sdk flexSdk = FlexSdkUtils.findFlexOrFlexmojosSdk(flexSdkName); if (flexSdk == null) { throw new ExecutionException(HaxeBundle.message("flex.sdk.not.found", flexSdkName)); } final FlexBuildConfiguration bc = new FakeFlexBuildConfiguration(flexSdk, null); final XDebugSession debugSession = XDebuggerManager.getInstance(module.getProject()).startSession(env, new XDebugProcessStarter() { @NotNull public XDebugProcess start(@NotNull final XDebugSession session) throws ExecutionException { try { OpenFLRunningState runningState = new OpenFLRunningState(env, module, false, true); final ExecutionResult executionResult = runningState.execute(executor, runner); final BCBasedRunnerParameters params = new BCBasedRunnerParameters(); params.setModuleName(module.getName()); return new HaxeDebugProcess(session, bc, params); } catch (IOException e) { throw new ExecutionException(e.getMessage(), e); } } }); return debugSession.getRunContentDescriptor(); }
Example #10
Source File: HaxeFlashDebuggingUtil.java From intellij-haxe with Apache License 2.0 | 5 votes |
public static RunContentDescriptor getNMEDescriptor(final HaxeDebugRunner runner, final Module module, final ExecutionEnvironment env, final Executor executor, String flexSdkName) throws ExecutionException { final Sdk flexSdk = FlexSdkUtils.findFlexOrFlexmojosSdk(flexSdkName); if (flexSdk == null) { throw new ExecutionException(HaxeBundle.message("flex.sdk.not.found", flexSdkName)); } final FlexBuildConfiguration bc = new FakeFlexBuildConfiguration(flexSdk, null); final XDebugSession debugSession = XDebuggerManager.getInstance(module.getProject()).startSession(env, new XDebugProcessStarter() { @NotNull public XDebugProcess start(@NotNull final XDebugSession session) throws ExecutionException { try { NMERunningState runningState = new NMERunningState(env, module, false, true); final ExecutionResult executionResult = runningState.execute(executor, runner); final BCBasedRunnerParameters params = new BCBasedRunnerParameters(); params.setModuleName(module.getName()); return new HaxeDebugProcess(session, bc, params); } catch (IOException e) { throw new ExecutionException(e.getMessage(), e); } } }); return debugSession.getRunContentDescriptor(); }
Example #11
Source File: ContextAwareDebugProcess.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
public ContextAwareDebugProcess(@NotNull XDebugSession session, ProcessHandler processHandler, Map<String, XDebugProcess> debugProcesses, String defaultContext) { super(session); this.processHandler = processHandler; this.debugProcesses = debugProcesses; this.currentContext = defaultContext; this.defaultContext = defaultContext; }
Example #12
Source File: RoboVmRunner.java From robovm-idea with GNU General Public License v2.0 | 5 votes |
@Nullable protected RunContentDescriptor attachVirtualMachine(RunProfileState state, @NotNull ExecutionEnvironment env, RemoteConnection connection, boolean pollConnection) throws ExecutionException { DebugEnvironment environment = new DefaultDebugUIEnvironment(env, state, connection, pollConnection).getEnvironment(); final DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(env.getProject()).attachVirtualMachine(environment); if (debuggerSession == null) { return null; } final DebugProcessImpl debugProcess = debuggerSession.getProcess(); if (debugProcess.isDetached() || debugProcess.isDetaching()) { debuggerSession.dispose(); return null; } // optimization: that way BatchEvaluator will not try to lookup the class file in remote VM // which is an expensive operation when executed first time debugProcess.putUserData(BatchEvaluator.REMOTE_SESSION_KEY, Boolean.TRUE); 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()); sessionImpl.addExtraStopActions(((DefaultExecutionResult)executionResult).getAdditionalStopActions()); } return JavaDebugProcess.create(session, debuggerSession); } }).getRunContentDescriptor(); }
Example #13
Source File: ContextAwareDebugProcess.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
@Override public void registerAdditionalActions(@NotNull DefaultActionGroup leftToolbar, @NotNull DefaultActionGroup topToolbar, @NotNull DefaultActionGroup settings) { final Collection<XDebugProcess> values = debugProcesses.values(); for (XDebugProcess value : values) { value.registerAdditionalActions(leftToolbar, topToolbar, settings); } }
Example #14
Source File: ContextAwareDebugProcess.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
@Override @NotNull public Promise stopAsync() { final Collection<XDebugProcess> values = debugProcesses.values(); for (XDebugProcess value : values) { value.stopAsync(); } return getDefaultDebugProcesses().stopAsync(); }
Example #15
Source File: ContextAwareDebugProcess.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
@Override public void stop() { final Collection<XDebugProcess> values = debugProcesses.values(); for (XDebugProcess value : values) { value.stop(); } }
Example #16
Source File: ContextAwareDebugProcess.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
@Override @NotNull public XBreakpointHandler<?>[] getBreakpointHandlers() { List<XBreakpointHandler> breakpointHandlers = new ArrayList<>(); final Collection<XDebugProcess> values = debugProcesses.values(); for (XDebugProcess value : values) { breakpointHandlers.addAll(Arrays.asList(value.getBreakpointHandlers())); } return breakpointHandlers.toArray(new XBreakpointHandler[breakpointHandlers.size()]); }
Example #17
Source File: ContextAwareDebugProcess.java From mule-intellij-plugins with Apache License 2.0 | 4 votes |
public XDebugProcess getDebugProcesses() { final XDebugProcess debugProcess = currentContext != null ? debugProcesses.get(currentContext) : null; return debugProcess != null ? debugProcess : getDefaultDebugProcesses(); }
Example #18
Source File: ContextAwareDebugProcess.java From mule-intellij-plugins with Apache License 2.0 | 4 votes |
public XDebugProcess getDefaultDebugProcesses() { return debugProcesses.get(defaultContext); }
Example #19
Source File: TestExecutionState.java From buck with Apache License 2.0 | 4 votes |
private void attachDebugger(String title, String port) { final RemoteConnection remoteConnection = new RemoteConnection(/* useSockets */ true, "localhost", port, /* serverMode */ false); final RemoteStateState state = new RemoteStateState(mProject, remoteConnection); final String name = title + " debugger (" + port + ")"; final ConfigurationFactory cfgFactory = ConfigurationTypeUtil.findConfigurationType("Remote").getConfigurationFactories()[0]; RunnerAndConfigurationSettings runSettings = RunManager.getInstance(mProject).createRunConfiguration(name, cfgFactory); final Executor debugExecutor = DefaultDebugExecutor.getDebugExecutorInstance(); final ExecutionEnvironment env = new ExecutionEnvironmentBuilder(mProject, debugExecutor) .runProfile(runSettings.getConfiguration()) .build(); final int pollTimeout = 3000; final DebugEnvironment environment = new DefaultDebugEnvironment(env, state, remoteConnection, pollTimeout); ApplicationManager.getApplication() .invokeLater( () -> { try { final DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(mProject).attachVirtualMachine(environment); if (debuggerSession == null) { return; } XDebuggerManager.getInstance(mProject) .startSessionAndShowTab( name, null, new XDebugProcessStarter() { @Override @NotNull public XDebugProcess start(@NotNull XDebugSession session) { return JavaDebugProcess.create(session, debuggerSession); } }); } catch (ExecutionException e) { LOG.error( "failed to attach to debugger on port " + port + " with polling timeout " + pollTimeout); } }); }
Example #20
Source File: XDebugProcessStarter.java From consulo with Apache License 2.0 | 2 votes |
/** * Create a new instance of {@link XDebugProcess} implementation. Note that <code>session</code> isn't initialized when this method is * called so in order to perform code depending on <code>session</code> parameter override {@link XDebugProcess#sessionInitialized} method * @param session session to be passed to {@link XDebugProcess#XDebugProcess} constructor * @return new {@link XDebugProcess} instance */ @Nonnull public XDebugProcess start(@Nonnull XDebugSession session) throws ExecutionException;