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

Bug 343752: Restart no longer works with GDB >= 7.0

This commit is contained in:
Marc Khouzam 2011-04-30 18:20:53 +00:00
parent 17c5a3eb29
commit 6f411b236b

View file

@ -474,6 +474,14 @@ public class GDBProcesses_7_0 extends AbstractDsfService
*/ */
private boolean fInitialProcess = true; private boolean fInitialProcess = true;
/**
* Keeps track of the fact that we are restarting a process or not.
* This is important so that we know if we should automatically terminate
* GDB or not. If the process is being restarted, we have to make sure
* not to kill GDB.
*/
private boolean fProcRestarting;
public GDBProcesses_7_0(DsfSession session) { public GDBProcesses_7_0(DsfSession session) {
super(session); super(session);
} }
@ -1236,7 +1244,15 @@ public class GDBProcesses_7_0 extends AbstractDsfService
/** @since 4.0 */ /** @since 4.0 */
public void restart(IContainerDMContext containerDmc, Map<String, Object> attributes, DataRequestMonitor<IContainerDMContext> rm) { public void restart(IContainerDMContext containerDmc, Map<String, Object> attributes, DataRequestMonitor<IContainerDMContext> rm) {
startOrRestart(containerDmc, attributes, true, rm); fProcRestarting = true;
startOrRestart(containerDmc, attributes, true, new DataRequestMonitor<IContainerDMContext>(ImmediateExecutor.getInstance(), rm) {
@Override
protected void handleFailure() {
fProcRestarting = false;
setData(getData());
super.handleFailure();
};
});
} }
/** @since 4.0 */ /** @since 4.0 */
@ -1337,14 +1353,16 @@ public class GDBProcesses_7_0 extends AbstractDsfService
if (Platform.getPreferencesService().getBoolean("org.eclipse.cdt.dsf.gdb.ui", //$NON-NLS-1$ if (Platform.getPreferencesService().getBoolean("org.eclipse.cdt.dsf.gdb.ui", //$NON-NLS-1$
IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB,
true, null)) { true, null)) {
if (fNumConnected == 0) { if (fNumConnected == 0 && !fProcRestarting) {
// If the last process we are debugging finishes, let's terminate GDB // If the last process we are debugging finishes, and we are not restarting it,
// let's terminate GDB.
// We also do this for a remote attach session, since the 'auto terminate' preference // We also do this for a remote attach session, since the 'auto terminate' preference
// is enabled. If users want to keep the session alive to attach to another process, // is enabled. If users want to keep the session alive to attach to another process,
// they can simply disable that preference // they can simply disable that preference
fCommandControl.terminate(new RequestMonitor(ImmediateExecutor.getInstance(), null)); fCommandControl.terminate(new RequestMonitor(ImmediateExecutor.getInstance(), null));
} }
} }
fProcRestarting = false;
} else { } else {
fThreadCommandCache.reset(); fThreadCommandCache.reset();
} }