1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 340535: Attach session should allow to create a new process for multi-process

This commit is contained in:
Marc Khouzam 2011-05-05 15:56:52 +00:00
parent bb9af0b61c
commit 93b8e52303
2 changed files with 14 additions and 32 deletions

View file

@ -204,19 +204,14 @@ public class DebugNewProcessSequence extends ReflectionSequence {
*/ */
@Execute @Execute
public void stepRemoteConnection(RequestMonitor rm) { public void stepRemoteConnection(RequestMonitor rm) {
// If we are dealing with a remote session, it is now time to connect // If we are dealing with a non-attach remote session, it is now time to connect
// to the remote side. Note that this is the 'target remote' case // to the remote side. Note that this is the 'target remote' case
// and not the 'target extended-remote' case (remote attach session) // and not the 'target extended-remote' case (remote attach session)
// We know this because a remote attach session does not start a new
// process, so we wouldn't be in this sequence
// This step is actually global for GDB. However, we have to do it after // This step is actually global for GDB. However, we have to do it after
// we have specified the executable, so we have to do it here. // we have specified the executable, so we have to do it here.
// It is safe to do it here because a 'target remote' does not support // It is safe to do it here because a 'target remote' does not support
// multi-process so this step will not be executed more than once. // multi-process so this step will not be executed more than once.
if (fBackend.getSessionType() == SessionType.REMOTE && !fBackend.getIsAttachSession()) {
assert fBackend.getIsAttachSession() == false;
if (fBackend.getSessionType() == SessionType.REMOTE) {
boolean isTcpConnection = CDebugUtils.getAttribute( boolean isTcpConnection = CDebugUtils.getAttribute(
fAttributes, fAttributes,
IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP,

View file

@ -126,25 +126,6 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
@Override @Override
protected String[] getExecutionOrder(String group) { protected String[] getExecutionOrder(String group) {
if (GROUP_TOP_LEVEL.equals(group)) { if (GROUP_TOP_LEVEL.equals(group)) {
DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), fContainerDmc.getSessionId());
IGDBBackend backend = tracker.getService(IGDBBackend.class);
tracker.dispose();
if (backend.getIsAttachSession()) {
// Restart does not apply to attach sessions, so we are only dealing with the
// Start case.
//
// When attaching to a running process, we do not need to set a breakpoint or
// start the program; it is left up to the user.
// We only need to turn on Reverse Debugging if requested.
return new String[] {
"stepInitializeBaseSequence", //$NON-NLS-1$
"stepEnableReverse", //$NON-NLS-1$
"stepCleanupBaseSequence", //$NON-NLS-1$
};
} else {
return new String[] { return new String[] {
"stepInitializeBaseSequence", //$NON-NLS-1$ "stepInitializeBaseSequence", //$NON-NLS-1$
"stepInsertStopOnMainBreakpoint", //$NON-NLS-1$ "stepInsertStopOnMainBreakpoint", //$NON-NLS-1$
@ -158,7 +139,6 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
"stepCleanupBaseSequence", //$NON-NLS-1$ "stepCleanupBaseSequence", //$NON-NLS-1$
}; };
} }
}
return null; return null;
} }
@ -272,18 +252,21 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
/** /**
* This method does the necessary work to setup the input/output streams for the * This method does the necessary work to setup the input/output streams for the
* inferior process, by either preparing the PTY to be used, to simply leaving * inferior process, by either preparing the PTY to be used, or by simply leaving
* the PTY null, which indicates that the input/output streams of the CLI should * the PTY null, which indicates that the input/output streams of the CLI should
* be used instead; this decision is based on the type of session. * be used instead; this decision is based on the type of session.
*/ */
@Execute @Execute
public void stepInitializeInputOutput(final RequestMonitor rm) { public void stepInitializeInputOutput(final RequestMonitor rm) {
if (fBackend.getSessionType() == SessionType.REMOTE || fBackend.getIsAttachSession()) { if (fBackend.getSessionType() == SessionType.REMOTE && !fBackend.getIsAttachSession()) {
// These types do not use a PTY // Remote non-attach sessions don't support multi-process and therefore will not
// start new processes. Those sessions will only start the one process, which should
// not have a console, because it's output is handled by GDB server.
fPty = null; fPty = null;
rm.done(); rm.done();
} else { } else {
// These types always use a PTY // Every other type of session that can get to this code, is starting a new process
// and requires a pty for it.
try { try {
fPty = new PTY(); fPty = new PTY();
@ -328,10 +311,14 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
// there for this case, specifically. // there for this case, specifically.
// Bug 342351 // Bug 342351
IGDBBackend backend = fTracker.getService(IGDBBackend.class); IGDBBackend backend = fTracker.getService(IGDBBackend.class);
String defaultPathName = backend.getProgramPath().lastSegment();
if (defaultPathName == null) {
defaultPathName = ""; //$NON-NLS-1$
}
String progPathName = String progPathName =
CDebugUtils.getAttribute(fAttributes, CDebugUtils.getAttribute(fAttributes,
ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
backend.getProgramPath().lastSegment()); defaultPathName);
final String pathLabel = new Path(progPathName).lastSegment(); final String pathLabel = new Path(progPathName).lastSegment();
// Add the inferior to the launch. // Add the inferior to the launch.