mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Bug 371198: Restart is not supported in a remote debug session.
This commit is contained in:
parent
7d58e68849
commit
35530262d8
3 changed files with 35 additions and 6 deletions
|
@ -101,6 +101,11 @@ public class BaseTestCase {
|
||||||
|
|
||||||
public synchronized MIStoppedEvent getInitialStoppedEvent() { return fInitialStoppedEvent; }
|
public synchronized MIStoppedEvent getInitialStoppedEvent() { return fInitialStoppedEvent; }
|
||||||
|
|
||||||
|
public static boolean isRemoteSession() {
|
||||||
|
return launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE)
|
||||||
|
.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We listen for the target to stop at the main breakpoint. This listener is
|
* We listen for the target to stop at the main breakpoint. This listener is
|
||||||
* installed when the session is created and we uninstall ourselves when we
|
* installed when the session is created and we uninstall ourselves when we
|
||||||
|
|
|
@ -635,9 +635,9 @@ public class SyncUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restart the program.
|
* Check if the restart operation is supported
|
||||||
*/
|
*/
|
||||||
public static MIStoppedEvent restart(final GdbLaunch launch) throws Throwable {
|
public static boolean canRestart() throws Throwable {
|
||||||
final IContainerDMContext containerDmc = getContainerContext();
|
final IContainerDMContext containerDmc = getContainerContext();
|
||||||
|
|
||||||
// Check if restart is allowed
|
// Check if restart is allowed
|
||||||
|
@ -659,7 +659,17 @@ public class SyncUtil {
|
||||||
|
|
||||||
fGdbControl.getExecutor().execute(query);
|
fGdbControl.getExecutor().execute(query);
|
||||||
boolean canRestart = query.get(500, TimeUnit.MILLISECONDS);
|
boolean canRestart = query.get(500, TimeUnit.MILLISECONDS);
|
||||||
if (!canRestart) {
|
return canRestart;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restart the program.
|
||||||
|
*/
|
||||||
|
public static MIStoppedEvent restart(final GdbLaunch launch) throws Throwable {
|
||||||
|
final IContainerDMContext containerDmc = getContainerContext();
|
||||||
|
|
||||||
|
// If we are calling this method, the restart operation should be allowed
|
||||||
|
if (!canRestart()) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID, "Unable to restart"));
|
throw new CoreException(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID, "Unable to restart"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,13 @@ public class OperationsWhileTargetIsRunningTest extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void restartWhileTargetRunningKillGDB() throws Throwable {
|
public void restartWhileTargetRunningKillGDB() throws Throwable {
|
||||||
|
// Restart is not supported for a remote session
|
||||||
|
if (BaseTestCase.isRemoteSession()) {
|
||||||
|
Assert.assertFalse("Restart operation should not be allowed for a remote session",
|
||||||
|
SyncUtil.canRestart());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// First set the preference to kill GDB (although it should not happen in this test)
|
// First set the preference to kill GDB (although it should not happen in this test)
|
||||||
Preferences node = DefaultScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID);
|
Preferences node = DefaultScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID);
|
||||||
node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true);
|
node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true);
|
||||||
|
@ -132,6 +139,13 @@ public class OperationsWhileTargetIsRunningTest extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void restartWhileTargetRunningGDBAlive() throws Throwable {
|
public void restartWhileTargetRunningGDBAlive() throws Throwable {
|
||||||
|
// Restart is not supported for a remote session
|
||||||
|
if (BaseTestCase.isRemoteSession()) {
|
||||||
|
Assert.assertFalse("Restart operation should not be allowed for a remote session",
|
||||||
|
SyncUtil.canRestart());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// First set the preference not to kill gdb
|
// First set the preference not to kill gdb
|
||||||
Preferences node = DefaultScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID);
|
Preferences node = DefaultScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID);
|
||||||
node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, false);
|
node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, false);
|
||||||
|
|
Loading…
Add table
Reference in a new issue