1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Bug 319165: Unnecessary step in GDBControl_7_0.startOrRestart

This commit is contained in:
Marc Khouzam 2010-07-08 15:32:27 +00:00
parent e95033ded7
commit 00be5f63e3

View file

@ -342,33 +342,10 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
// so let's use a sequence. // so let's use a sequence.
getExecutor().execute(new Sequence(getExecutor(), requestMonitor) { getExecutor().execute(new Sequence(getExecutor(), requestMonitor) {
IContainerDMContext fContainerDmc; IContainerDMContext fContainerDmc;
ICommand<MIInfo> fExecCommand;
String fUserStopSymbol = null;
MIBreakpoint fUserBreakpoint = null; MIBreakpoint fUserBreakpoint = null;
boolean fUserBreakpointIsOnMain = false; boolean fUserBreakpointIsOnMain = false;
Step[] fSteps = new Step[] { Step[] fSteps = new Step[] {
/*
* Figure out if we should use 'exec-continue' or '-exec-run'.
*/
new Step() {
@Override
public void execute(RequestMonitor rm) {
IMIProcesses procService = getServicesTracker().getService(IMIProcesses.class);
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
fContainerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
if (fMIBackend.getSessionType() == SessionType.REMOTE) {
// Restart does not apply to remote sessions
//
// When doing remote debugging, we use -exec-continue instead of -exec-run
fExecCommand = getCommandFactory().createMIExecContinue(fContainerDmc);
} else {
fExecCommand = getCommandFactory().createMIExecRun(fContainerDmc);
}
rm.done();
}},
/* /*
* If the user requested a 'stopOnMain', let's set the temporary breakpoint * If the user requested a 'stopOnMain', let's set the temporary breakpoint
* where the user specified. * where the user specified.
@ -388,8 +365,9 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
} }
if (userRequestedStop) { if (userRequestedStop) {
String userStopSymbol = null;
try { try {
fUserStopSymbol = launch.getLaunchConfiguration().getAttribute( userStopSymbol = launch.getLaunchConfiguration().getAttribute(
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);
} catch (CoreException e) { } catch (CoreException e) {
@ -398,7 +376,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
return; return;
} }
queueCommand(getCommandFactory().createMIBreakInsert(fControlDmc, true, false, null, 0, fUserStopSymbol, 0), queueCommand(getCommandFactory().createMIBreakInsert(fControlDmc, true, false, null, 0, userStopSymbol, 0),
new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), rm) { new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), rm) {
@Override @Override
public void handleSuccess() { public void handleSuccess() {
@ -444,12 +422,26 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
} }
}}, }},
/* /*
* Now, run the program. * Now, run the program. Use either -exec-run or -exec-continue depending
* on whether we have remote session or not.
*/ */
new Step() { new Step() {
@Override @Override
public void execute(RequestMonitor rm) { public void execute(RequestMonitor rm) {
queueCommand(fExecCommand, new DataRequestMonitor<MIInfo>(getExecutor(), rm)); IMIProcesses procService = getServicesTracker().getService(IMIProcesses.class);
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
fContainerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
ICommand<MIInfo> command;
if (fMIBackend.getSessionType() == SessionType.REMOTE) {
// Restart does not apply to remote sessions
//
// When doing remote debugging, we use -exec-continue instead of -exec-run
command = getCommandFactory().createMIExecContinue(fContainerDmc);
} else {
command = getCommandFactory().createMIExecRun(fContainerDmc);
}
queueCommand(command, new DataRequestMonitor<MIInfo>(getExecutor(), rm));
}}, }},
/* /*
* In case of a restart, reverse debugging should be marked as off here because * In case of a restart, reverse debugging should be marked as off here because