1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-11 18:25:40 +02:00

[258284] Don't allow a reverse-finish when in main() since GDB will reject it.

This commit is contained in:
Marc Khouzam 2009-02-17 21:17:44 +00:00
parent fbb7101ddc
commit f91e2530ac

View file

@ -179,13 +179,43 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro
} }
/** @since 2.0 */ /** @since 2.0 */
public void canReverseStep(IExecutionDMContext context, StepType stepType, DataRequestMonitor<Boolean> rm) { public void canReverseStep(final IExecutionDMContext context, StepType stepType, final DataRequestMonitor<Boolean> rm) {
if (context instanceof IContainerDMContext) { if (context instanceof IContainerDMContext) {
rm.setData(false); rm.setData(false);
rm.done(); rm.done();
return; return;
} }
if (stepType == StepType.STEP_RETURN) {
// A step return will always be done in the top stack frame.
// If the top stack frame is the only stack frame, it does not make sense
// to do a step return since GDB will reject it.
// Until bug 256798 is fixed, the service tracker could be null
if (getServicesTracker() == null) {
// service is shutdown
rm.setData(false);
rm.done();
return;
}
MIStack stackService = getServicesTracker().getService(MIStack.class);
if (stackService != null) {
// Check that the stack is at least two deep.
stackService.getStackDepth(context, 2, new DataRequestMonitor<Integer>(getExecutor(), rm) {
@Override
public void handleCompleted() {
if (isSuccess() && getData() == 1) {
rm.setData(false);
rm.done();
} else {
canReverseResume(context, rm);
}
}
});
return;
}
}
canReverseResume(context, rm); canReverseResume(context, rm);
} }