com.intellij.debugger.DebuggerManagerEx Java Examples
The following examples show how to use
com.intellij.debugger.DebuggerManagerEx.
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: BlazeHotSwapManager.java From intellij with Apache License 2.0 | 6 votes |
@Nullable static HotSwappableDebugSession findHotSwappableBlazeDebuggerSession(Project project) { DebuggerManagerEx debuggerManager = DebuggerManagerEx.getInstanceEx(project); DebuggerSession session = debuggerManager.getContext().getDebuggerSession(); if (session == null || !session.isAttached()) { return null; } JavaDebugProcess process = session.getProcess().getXdebugProcess(); if (process == null) { return null; } ExecutionEnvironment env = ((XDebugSessionImpl) process.getSession()).getExecutionEnvironment(); if (env == null || ClassFileManifestBuilder.getManifest(env) == null) { return null; } RunProfile runProfile = env.getRunProfile(); if (!(runProfile instanceof BlazeCommandRunConfiguration)) { return null; } return new HotSwappableDebugSession(session, env, (BlazeCommandRunConfiguration) runProfile); }
Example #2
Source File: MultiRunDebuggerSessionListener.java From intellij with Apache License 2.0 | 5 votes |
public MultiRunDebuggerSessionListener( ExecutionEnvironment executionEnvironment, RemoteState state) { this.executionEnvironment = executionEnvironment; this.debuggerManager = DebuggerManagerEx.getInstanceEx(executionEnvironment.getProject()); RemoteConnection remoteConnection = state.getRemoteConnection(); debugEnvironment = new DefaultDebugEnvironment(executionEnvironment, state, remoteConnection, true); }
Example #3
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 #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); } }); }