1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Implement interrupt()

This commit is contained in:
Alain Magloire 2002-09-03 04:14:53 +00:00
parent f309922d7c
commit 06345ac843

View file

@ -13,10 +13,12 @@ import java.io.PipedOutputStream;
import org.eclipse.cdt.debug.mi.core.command.CLICommand; import org.eclipse.cdt.debug.mi.core.command.CLICommand;
import org.eclipse.cdt.debug.mi.core.command.CommandFactory; import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
import org.eclipse.cdt.debug.mi.core.command.MIExecAbort; import org.eclipse.cdt.debug.mi.core.command.MIExecAbort;
import org.eclipse.cdt.debug.mi.core.command.MIExecInterrupt;
import org.eclipse.cdt.debug.mi.core.command.MIGDBShowExitCode; import org.eclipse.cdt.debug.mi.core.command.MIGDBShowExitCode;
import org.eclipse.cdt.debug.mi.core.event.MIInferiorExitEvent; import org.eclipse.cdt.debug.mi.core.event.MIInferiorExitEvent;
import org.eclipse.cdt.debug.mi.core.output.MIGDBShowExitCodeInfo; import org.eclipse.cdt.debug.mi.core.output.MIGDBShowExitCodeInfo;
import org.eclipse.cdt.debug.mi.core.output.MIInfo; import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.cdt.utils.spawner.Spawner;
/** /**
*/ */
@ -155,6 +157,23 @@ public class MIInferior extends Process {
} }
} }
public void interrupt() {
Process gdb = session.getMIProcess();
if (gdb instanceof Spawner) {
Spawner gdbSpawner = (Spawner)gdb;
gdbSpawner.interrupt();
} else {
// Try the exec-interrupt;
CommandFactory factory = session.getCommandFactory();
MIExecInterrupt interrupt = factory.createMIExecInterrupt();
try {
session.postCommand(interrupt);
MIInfo info = interrupt.getMIInfo();
} catch (MIException e) {
}
}
}
public synchronized boolean isSuspended() { public synchronized boolean isSuspended() {
return state == SUSPENDED; return state == SUSPENDED;
} }