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
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
// 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
// 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
// multi-process so this step will not be executed more than once.
assert fBackend.getIsAttachSession() == false;
if (fBackend.getSessionType() == SessionType.REMOTE) {
if (fBackend.getSessionType() == SessionType.REMOTE && !fBackend.getIsAttachSession()) {
boolean isTcpConnection = CDebugUtils.getAttribute(
fAttributes,
IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP,

View file

@ -126,25 +126,6 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
@Override
protected String[] getExecutionOrder(String 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[] {
"stepInitializeBaseSequence", //$NON-NLS-1$
"stepInsertStopOnMainBreakpoint", //$NON-NLS-1$
@ -158,7 +139,6 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
"stepCleanupBaseSequence", //$NON-NLS-1$
};
}
}
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
* 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
* be used instead; this decision is based on the type of session.
*/
@Execute
public void stepInitializeInputOutput(final RequestMonitor rm) {
if (fBackend.getSessionType() == SessionType.REMOTE || fBackend.getIsAttachSession()) {
// These types do not use a PTY
if (fBackend.getSessionType() == SessionType.REMOTE && !fBackend.getIsAttachSession()) {
// 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;
rm.done();
} 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 {
fPty = new PTY();
@ -328,10 +311,14 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
// there for this case, specifically.
// Bug 342351
IGDBBackend backend = fTracker.getService(IGDBBackend.class);
String defaultPathName = backend.getProgramPath().lastSegment();
if (defaultPathName == null) {
defaultPathName = ""; //$NON-NLS-1$
}
String progPathName =
CDebugUtils.getAttribute(fAttributes,
ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
backend.getProgramPath().lastSegment());
defaultPathName);
final String pathLabel = new Path(progPathName).lastSegment();
// Add the inferior to the launch.