com.intellij.debugger.DebugEnvironment Java Examples
The following examples show how to use
com.intellij.debugger.DebugEnvironment.
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: MultiRunDebuggerSessionListener.java From intellij with Apache License 2.0 | 5 votes |
private static void reattach(DebugProcessImpl process, DebugEnvironment debugEnvironment) throws ExecutionException { // Reattaching the debug process happens in a new worker thread request. // Stop the existing request first to avoid an IllegalStateException in // InvokeThread#run. process.getManagerThread().getCurrentRequest().requestStop(); process.reattach(debugEnvironment); }
Example #2
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 #3
Source File: MultiRunDebuggerSessionListener.java From intellij with Apache License 2.0 | 4 votes |
public ReattachJvmProcessListener( DebugEnvironment debugEnvironment, ExecutionEnvironment executionEnvironment) { this.debugEnvironment = debugEnvironment; this.executionEnvironment = executionEnvironment; }
Example #4
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); } }); }