Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Khouzam2015-05-05 19:53:24 +0000
committerMarc Khouzam2015-05-15 14:26:17 +0000
commitcf6b8c725f4a629619d745cd8ba68d326233fb25 (patch)
treeb83248e8c12c995d010f0fa4ba3c01633820a46b
parent096aa0f966a840b2ad429f7dca574e401bdd2968 (diff)
downloadorg.eclipse.cdt-cf6b8c725f4a629619d745cd8ba68d326233fb25.tar.gz
org.eclipse.cdt-cf6b8c725f4a629619d745cd8ba68d326233fb25.tar.xz
org.eclipse.cdt-cf6b8c725f4a629619d745cd8ba68d326233fb25.zip
Bug 466492 - Remove console when removing exited processes
Change-Id: I029c89d81fc0f0e96dc8f3b160ea5286b0adb5ba Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com> (cherry picked from commit 0ec42e99dd868d0f02153ddadeb72169c59c7eab)
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java40
1 files changed, 36 insertions, 4 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java
index 78ed645e640..3a6c2f5da02 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java
@@ -64,8 +64,10 @@ import org.eclipse.cdt.dsf.debug.service.command.CommandCache;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
import org.eclipse.cdt.dsf.debug.service.command.IEventListener;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
+import org.eclipse.cdt.dsf.gdb.IGdbDebugConstants;
import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
+import org.eclipse.cdt.dsf.gdb.launching.InferiorRuntimeProcess;
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
@@ -98,6 +100,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IProcess;
import org.osgi.framework.BundleContext;
/**
@@ -1207,8 +1210,11 @@ public class GDBProcesses_7_0 extends AbstractDsfService
public void detachDebuggerFromProcess(final IDMContext dmc, final RequestMonitor rm) {
MIExitedProcessDMC exitedProc = DMContexts.getAncestorOfType(dmc, MIExitedProcessDMC.class);
if (exitedProc != null) {
- // For an exited process, simply remove the entry from our table to stop showing it.
- getExitedProcesses().remove(exitedProc.getGroupId());
+ // For an exited process, remove the entry from our table to stop showing it, and
+ // remove the entry from the launch itself to remove the process's console
+ String groupId = exitedProc.getGroupId();
+ getExitedProcesses().remove(groupId);
+ removeProcessFromLaunch(groupId);
getSession().dispatchEvent(new ProcessRemovedDMEvent(exitedProc), null);
return;
}
@@ -1525,8 +1531,11 @@ public class GDBProcesses_7_0 extends AbstractDsfService
@Override
public void terminate(IThreadDMContext thread, final RequestMonitor rm) {
if (thread instanceof MIExitedProcessDMC) {
- // For an exited process, simply remove the entry from our table to stop showing it.
- getExitedProcesses().remove(((MIExitedProcessDMC)thread).getGroupId());
+ // For an exited process, remove the entry from our table to stop showing it, and
+ // remove the entry from the launch itself to remove the process's console
+ String groupId = ((MIExitedProcessDMC)thread).getGroupId();
+ getExitedProcesses().remove(groupId);
+ removeProcessFromLaunch(groupId);
getSession().dispatchEvent(new ProcessRemovedDMEvent((IProcessDMContext)thread), null);
} else if (fBackend.getSessionType() == SessionType.CORE) {
// For a core session, there is no concept of killing the inferior,
@@ -1680,6 +1689,29 @@ public class GDBProcesses_7_0 extends AbstractDsfService
return new StartOrRestartProcessSequence_7_0(executor, containerDmc, attributes, restart, rm);
}
+
+ /**
+ * Removes the process with the specified groupId from the launch.
+ */
+ private void removeProcessFromLaunch(String groupId) {
+ ILaunch launch = (ILaunch)getSession().getModelAdapter(ILaunch.class);
+ IProcess[] launchProcesses = launch.getProcesses();
+ for (IProcess process : launchProcesses) {
+ if (process instanceof InferiorRuntimeProcess) {
+ String groupAttribute = process.getAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR);
+
+ // if the groupAttribute is not set in the process we know we are dealing
+ // with single process debugging so the one process is the one we want.
+ // If the groupAttribute is set, then we must make sure it is the proper inferior
+ if (groupAttribute == null || groupAttribute.equals(MIProcesses.UNIQUE_GROUP_ID) ||
+ groupAttribute.equals(groupId)) {
+ launch.removeProcess(process);
+ break;
+ }
+ }
+ }
+ }
+
@DsfServiceEventHandler
public void eventDispatched(final MIThreadGroupCreatedEvent e) {
IProcessDMContext procDmc = e.getDMContext();

Back to the top