mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Cosmetics.
This commit is contained in:
parent
e14cadc60a
commit
03a2f1d859
1 changed files with 79 additions and 82 deletions
|
@ -58,7 +58,6 @@ import org.eclipse.debug.core.model.IProcess;
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
|
public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
|
||||||
|
|
||||||
private IGDBControl fCommandControl;
|
private IGDBControl fCommandControl;
|
||||||
private CommandFactory fCommandFactory;
|
private CommandFactory fCommandFactory;
|
||||||
private IGDBProcesses fProcService;
|
private IGDBProcesses fProcService;
|
||||||
|
@ -93,7 +92,6 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
|
||||||
// Therefore, doing it like this is more future-proof.
|
// Therefore, doing it like this is more future-proof.
|
||||||
private final DataRequestMonitor<IContainerDMContext> fDataRequestMonitor;
|
private final DataRequestMonitor<IContainerDMContext> fDataRequestMonitor;
|
||||||
|
|
||||||
|
|
||||||
protected IContainerDMContext getContainerContext() {
|
protected IContainerDMContext getContainerContext() {
|
||||||
return fContainerDmc;
|
return fContainerDmc;
|
||||||
}
|
}
|
||||||
|
@ -107,8 +105,8 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public StartOrRestartProcessSequence_7_0(DsfExecutor executor, IContainerDMContext containerDmc, Map<String, Object> attributes,
|
public StartOrRestartProcessSequence_7_0(DsfExecutor executor, IContainerDMContext containerDmc,
|
||||||
boolean restart, DataRequestMonitor<IContainerDMContext> rm) {
|
Map<String, Object> attributes, boolean restart, DataRequestMonitor<IContainerDMContext> rm) {
|
||||||
super(executor, rm);
|
super(executor, rm);
|
||||||
|
|
||||||
assert executor != null;
|
assert executor != null;
|
||||||
|
@ -127,18 +125,18 @@ 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)) {
|
||||||
return new String[] {
|
return new String[] {
|
||||||
"stepInitializeBaseSequence", //$NON-NLS-1$
|
"stepInitializeBaseSequence", //$NON-NLS-1$
|
||||||
"stepInsertStopOnMainBreakpoint", //$NON-NLS-1$
|
"stepInsertStopOnMainBreakpoint", //$NON-NLS-1$
|
||||||
"stepSetBreakpointForReverse", //$NON-NLS-1$
|
"stepSetBreakpointForReverse", //$NON-NLS-1$
|
||||||
"stepInitializeInputOutput", //$NON-NLS-1$
|
"stepInitializeInputOutput", //$NON-NLS-1$
|
||||||
"stepCreateConsole", //$NON-NLS-1$
|
"stepCreateConsole", //$NON-NLS-1$
|
||||||
"stepRunProgram", //$NON-NLS-1$
|
"stepRunProgram", //$NON-NLS-1$
|
||||||
"stepSetReverseOff", //$NON-NLS-1$
|
"stepSetReverseOff", //$NON-NLS-1$
|
||||||
"stepEnableReverse", //$NON-NLS-1$
|
"stepEnableReverse", //$NON-NLS-1$
|
||||||
"stepContinue", //$NON-NLS-1$
|
"stepContinue", //$NON-NLS-1$
|
||||||
"stepCleanupBaseSequence", //$NON-NLS-1$
|
"stepCleanupBaseSequence", //$NON-NLS-1$
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -167,8 +165,8 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
|
||||||
// it if we actually have a reverse debugging service. There is no point
|
// it if we actually have a reverse debugging service. There is no point
|
||||||
// in trying to handle reverse debugging if it is not available.
|
// in trying to handle reverse debugging if it is not available.
|
||||||
fReverseEnabled = CDebugUtils.getAttribute(fAttributes,
|
fReverseEnabled = CDebugUtils.getAttribute(fAttributes,
|
||||||
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
|
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
|
||||||
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT);
|
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
rm.done();
|
rm.done();
|
||||||
|
@ -191,13 +189,13 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
|
||||||
@Execute
|
@Execute
|
||||||
public void stepInsertStopOnMainBreakpoint(final RequestMonitor rm) {
|
public void stepInsertStopOnMainBreakpoint(final RequestMonitor rm) {
|
||||||
boolean userRequestedStop = CDebugUtils.getAttribute(fAttributes,
|
boolean userRequestedStop = CDebugUtils.getAttribute(fAttributes,
|
||||||
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN,
|
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN,
|
||||||
false);
|
false);
|
||||||
|
|
||||||
if (userRequestedStop) {
|
if (userRequestedStop) {
|
||||||
String userStopSymbol = CDebugUtils.getAttribute(fAttributes,
|
String userStopSymbol = CDebugUtils.getAttribute(fAttributes,
|
||||||
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
|
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
|
||||||
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT);
|
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT);
|
||||||
|
|
||||||
IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(getContainerContext(), IBreakpointsTargetDMContext.class);
|
IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(getContainerContext(), IBreakpointsTargetDMContext.class);
|
||||||
|
|
||||||
|
@ -233,7 +231,7 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
|
||||||
|
|
||||||
fCommandControl.queueCommand(
|
fCommandControl.queueCommand(
|
||||||
fCommandFactory.createMIBreakInsert(bpTargetDmc, true, false, null, 0,
|
fCommandFactory.createMIBreakInsert(bpTargetDmc, true, false, null, 0,
|
||||||
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT, 0),
|
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT, 0),
|
||||||
new DataRequestMonitor<MIBreakInsertInfo>(ImmediateExecutor.getInstance(), rm) {
|
new DataRequestMonitor<MIBreakInsertInfo>(ImmediateExecutor.getInstance(), rm) {
|
||||||
@Override
|
@Override
|
||||||
public void handleSuccess() {
|
public void handleSuccess() {
|
||||||
|
@ -295,71 +293,71 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
|
||||||
*/
|
*/
|
||||||
@Execute
|
@Execute
|
||||||
public void stepCreateConsole(final RequestMonitor rm) {
|
public void stepCreateConsole(final RequestMonitor rm) {
|
||||||
Process inferiorProcess;
|
Process inferiorProcess;
|
||||||
if (fPty == null) {
|
if (fPty == null) {
|
||||||
inferiorProcess = new MIInferiorProcess(fContainerDmc, fBackend.getMIOutputStream());
|
inferiorProcess = new MIInferiorProcess(fContainerDmc, fBackend.getMIOutputStream());
|
||||||
} else {
|
} else {
|
||||||
inferiorProcess = new MIInferiorProcess(fContainerDmc, fPty);
|
inferiorProcess = new MIInferiorProcess(fContainerDmc, fPty);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Process inferior = inferiorProcess;
|
final Process inferior = inferiorProcess;
|
||||||
final ILaunch launch = (ILaunch)getContainerContext().getAdapter(ILaunch.class);
|
final ILaunch launch = (ILaunch)getContainerContext().getAdapter(ILaunch.class);
|
||||||
|
|
||||||
// This is the groupId of the new process that will be started, even in the
|
// This is the groupId of the new process that will be started, even in the
|
||||||
// case of a restart.
|
// case of a restart.
|
||||||
final String groupId = ((IMIContainerDMContext)getContainerContext()).getGroupId();
|
final String groupId = ((IMIContainerDMContext)getContainerContext()).getGroupId();
|
||||||
|
|
||||||
// For multi-process, we cannot simply use the name given by the backend service
|
// 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.
|
// 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
|
// Instead, we can look in the attributes for the binary name, which we stored
|
||||||
// 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();
|
String defaultPathName = backend.getProgramPath().lastSegment();
|
||||||
if (defaultPathName == null) {
|
if (defaultPathName == null) {
|
||||||
defaultPathName = ""; //$NON-NLS-1$
|
defaultPathName = ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
String progPathName =
|
String progPathName =
|
||||||
CDebugUtils.getAttribute(fAttributes,
|
CDebugUtils.getAttribute(fAttributes,
|
||||||
ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
|
ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
|
||||||
defaultPathName);
|
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.
|
||||||
// This cannot be done on the executor or things deadlock.
|
// This cannot be done on the executor or things deadlock.
|
||||||
DebugPlugin.getDefault().asyncExec(new Runnable() {
|
DebugPlugin.getDefault().asyncExec(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
String label = pathLabel;
|
String label = pathLabel;
|
||||||
|
|
||||||
if (fRestart) {
|
if (fRestart) {
|
||||||
// For a restart, remove the old inferior
|
// For a restart, remove the old inferior
|
||||||
IProcess[] launchProcesses = launch.getProcesses();
|
IProcess[] launchProcesses = launch.getProcesses();
|
||||||
for (IProcess process : launchProcesses) {
|
for (IProcess process : launchProcesses) {
|
||||||
if (process instanceof InferiorRuntimeProcess) {
|
if (process instanceof InferiorRuntimeProcess) {
|
||||||
String groupAttribute = process.getAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR);
|
String groupAttribute = process.getAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR);
|
||||||
|
|
||||||
// if the groupAttribute is not set in the process we know we are dealing
|
// 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.
|
// 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 the groupAttribute is set, then we must make sure it is the proper inferior
|
||||||
if (groupAttribute == null || groupAttribute.equals(MIProcesses.UNIQUE_GROUP_ID) ||
|
if (groupAttribute == null || groupAttribute.equals(MIProcesses.UNIQUE_GROUP_ID) ||
|
||||||
groupAttribute.equals(groupId)) {
|
groupAttribute.equals(groupId)) {
|
||||||
launch.removeProcess(process);
|
launch.removeProcess(process);
|
||||||
// Use the exact same label as before
|
// Use the exact same label as before
|
||||||
label = process.getLabel();
|
label = process.getLabel();
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the inferior
|
|
||||||
InferiorRuntimeProcess runtimeInferior = new InferiorRuntimeProcess(launch, inferior, label, null);
|
|
||||||
runtimeInferior.setAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR, groupId);
|
|
||||||
launch.addProcess(runtimeInferior);
|
|
||||||
|
|
||||||
rm.done();
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
// Add the inferior
|
||||||
|
InferiorRuntimeProcess runtimeInferior = new InferiorRuntimeProcess(launch, inferior, label, null);
|
||||||
|
runtimeInferior.setAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR, groupId);
|
||||||
|
launch.addProcess(runtimeInferior);
|
||||||
|
|
||||||
|
rm.done();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -461,5 +459,4 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
|
||||||
// (multi-process), so we want to use -exec-run
|
// (multi-process), so we want to use -exec-run
|
||||||
return backend.getSessionType() == SessionType.REMOTE && !backend.getIsAttachSession();
|
return backend.getSessionType() == SessionType.REMOTE && !backend.getIsAttachSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue