From d825a579ced372bfd1aa72c4581c0eb9f66543ba Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Thu, 5 May 2011 01:32:06 +0000 Subject: [PATCH] Bug 342351: Process consoles are not named properly for multi-process --- .../dsf/gdb/service/DebugNewProcessSequence.java | 6 ++++++ .../service/StartOrRestartProcessSequence_7_0.java | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence.java index e7ed598dfda..4ebb772e977 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/DebugNewProcessSequence.java @@ -14,6 +14,7 @@ import java.util.Map; import java.util.Properties; import org.eclipse.cdt.debug.core.CDebugUtils; +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; import org.eclipse.cdt.dsf.concurrent.DsfExecutor; import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants; @@ -268,6 +269,11 @@ public class DebugNewProcessSequence extends ReflectionSequence { @Execute public void stepStartExecution(final RequestMonitor rm) { if (fBackend.getSessionType() != SessionType.CORE) { + // Overwrite the program name to use the binary name that was specified. + // This is important for multi-process + // Bug 342351 + fAttributes.put(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, fBinaryName); + fProcService.start(getContainerContext(), fAttributes, new DataRequestMonitor(ImmediateExecutor.getInstance(), rm) { @Override protected void handleSuccess() { diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java index 88ef27ae7b1..f2f9910822d 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java @@ -41,6 +41,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; import org.eclipse.cdt.dsf.service.DsfServicesTracker; import org.eclipse.cdt.utils.pty.PTY; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; @@ -321,9 +322,18 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence { final ILaunch launch = (ILaunch)getContainerContext().getAdapter(ILaunch.class); final String groupId = ((IMIContainerDMContext)getContainerContext()).getGroupId(); + // For multi-process, we cannot simply use the name given by the backend service + // because we may not be starting that process, but another one. + // Instead, we can look in the attributes for the binary name, which we stored + // there for this case, specifically. + // Bug 342351 IGDBBackend backend = fTracker.getService(IGDBBackend.class); - final String pathLabel = backend.getProgramPath().lastSegment(); - + String progPathName = + CDebugUtils.getAttribute(fAttributes, + ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, + backend.getProgramPath().lastSegment()); + final String pathLabel = new Path(progPathName).lastSegment(); + // Add the inferior to the launch. // This cannot be done on the executor or things deadlock. DebugPlugin.getDefault().asyncExec(new Runnable() {