use of com.intellij.debugger.impl.DebuggerSession in project intellij-community by JetBrains.
the class ExportThreadsAction method update.
public void update(AnActionEvent e) {
Presentation presentation = e.getPresentation();
Project project = e.getProject();
if (project == null) {
presentation.setEnabled(false);
return;
}
DebuggerSession debuggerSession = (DebuggerManagerEx.getInstanceEx(project)).getContext().getDebuggerSession();
presentation.setEnabled(debuggerSession != null && debuggerSession.isPaused());
}
use of com.intellij.debugger.impl.DebuggerSession in project android by JetBrains.
the class AndroidJavaDebugger method hasExistingDebugSession.
private static boolean hasExistingDebugSession(@NotNull Project project, @NotNull final String debugPort, @NotNull final String runConfigName) {
Collection<RunContentDescriptor> descriptors = null;
Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
Project targetProject = null;
// Scan through open project to find if this port has been opened in any session.
for (Project openProject : openProjects) {
targetProject = openProject;
// First check the titles of the run configurations.
descriptors = ExecutionHelper.findRunningConsoleByTitle(targetProject, new NotNullFunction<String, Boolean>() {
@NotNull
@Override
public Boolean fun(String title) {
return runConfigName.equals(title);
}
});
// If it can't find a matching title, check the debugger sessions.
if (descriptors.isEmpty()) {
DebuggerSession debuggerSession = findJdwpDebuggerSession(targetProject, debugPort);
if (debuggerSession != null) {
XDebugSession session = debuggerSession.getXDebugSession();
if (session != null) {
descriptors = Collections.singletonList(session.getRunContentDescriptor());
} else {
// Detach existing session.
debuggerSession.getProcess().stop(false);
}
}
}
if (!descriptors.isEmpty()) {
break;
}
}
if (descriptors != null && !descriptors.isEmpty()) {
return activateDebugSessionWindow(project, descriptors.iterator().next());
}
return false;
}
use of com.intellij.debugger.impl.DebuggerSession in project buck by facebook.
the class TestExecutionState method attachDebugger.
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);
}
});
}
use of com.intellij.debugger.impl.DebuggerSession in project intellij-community by JetBrains.
the class JavaAwareTestConsoleProperties method getDebugSession.
@Nullable
public DebuggerSession getDebugSession() {
final DebuggerManagerEx debuggerManager = DebuggerManagerEx.getInstanceEx(getProject());
if (debuggerManager == null)
return null;
final Collection<DebuggerSession> sessions = debuggerManager.getSessions();
for (final DebuggerSession debuggerSession : sessions) {
if (getConsole() == debuggerSession.getProcess().getExecutionResult().getExecutionConsole())
return debuggerSession;
}
return null;
}
use of com.intellij.debugger.impl.DebuggerSession in project intellij-community by JetBrains.
the class JvmSmartStepIntoActionHandler method perform.
public void perform(@NotNull final Project project, final AnActionEvent event) {
final DebuggerContextImpl debuggerContext = (DebuggerManagerEx.getInstanceEx(project)).getContext();
final DebuggerSession session = debuggerContext.getDebuggerSession();
if (session != null) {
doStep(project, debuggerContext.getSourcePosition(), session);
}
}
Aggregations