mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Allow the client to overload the interrupt
This commit is contained in:
parent
672ff00623
commit
2e8a72022a
5 changed files with 36 additions and 13 deletions
|
@ -1,3 +1,12 @@
|
|||
2004-01-30 Alain Magloire
|
||||
|
||||
Allow the clients to override the interrupt.
|
||||
|
||||
* src/org/eclipse/cdt/debug/mi/core/MIInferior.java
|
||||
* src/org/eclipse/cdt/debug/mi/core/TxThread.java
|
||||
* src/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java
|
||||
* src/org/eclipse/cdt/debug/mi/core/command/MICommand.java
|
||||
|
||||
2004-01-29 Alain Magloire
|
||||
|
||||
The CDT debug ui prefers things to be in ascending
|
||||
|
|
|
@ -12,10 +12,12 @@ import java.io.PipedOutputStream;
|
|||
|
||||
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.MIExecInterrupt;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIGDBShowExitCode;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIInfoProgram;
|
||||
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.MIInfo;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIInfoProgramInfo;
|
||||
import org.eclipse.cdt.utils.pty.PTY;
|
||||
import org.eclipse.cdt.utils.spawner.Spawner;
|
||||
|
@ -171,7 +173,24 @@ public class MIInferior extends Process {
|
|||
|
||||
public synchronized void interrupt() throws MIException {
|
||||
Process gdb = session.getGDBProcess();
|
||||
if (gdb instanceof Spawner) {
|
||||
// Check if they can handle the interrupt
|
||||
// Try the exec-interrupt; this will be for "gdb --async"
|
||||
CommandFactory factory = session.getCommandFactory();
|
||||
MIExecInterrupt interrupt = factory.createMIExecInterrupt();
|
||||
if (interrupt != null) {
|
||||
try {
|
||||
session.postCommand(interrupt);
|
||||
MIInfo info = interrupt.getMIInfo();
|
||||
// Allow (5 secs) for the interrupt to propagate.
|
||||
for (int i = 0;(state == RUNNING) && i < 5; i++) {
|
||||
try {
|
||||
wait(1000);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
} catch (MIException e) {
|
||||
}
|
||||
} else if (gdb instanceof Spawner) {
|
||||
Spawner gdbSpawner = (Spawner) gdb;
|
||||
gdbSpawner.interrupt();
|
||||
// Allow (5 secs) for the interrupt to propagate.
|
||||
|
@ -191,17 +210,8 @@ public class MIInferior extends Process {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Try the exec-interrupt; this will be for "gdb --async"
|
||||
// CommandFactory factory = session.getCommandFactory();
|
||||
// MIExecInterrupt interrupt = factory.createMIExecInterrupt();
|
||||
// try {
|
||||
// session.postCommand(interrupt);
|
||||
// MIInfo info = interrupt.getMIInfo();
|
||||
// } catch (MIException e) {
|
||||
// }
|
||||
//throw new MIException("Interruption no supported");
|
||||
}
|
||||
|
||||
// If we've failed throw an exception up.
|
||||
if (state == RUNNING) {
|
||||
throw new MIException("Failed to interrupt");
|
||||
|
|
|
@ -59,7 +59,7 @@ public class TxThread extends Thread {
|
|||
|
||||
// shove in the pipe
|
||||
String str = cmd.toString();
|
||||
if (out != null) {
|
||||
if (out != null && str.length() > 0) {
|
||||
out.write(str.getBytes());
|
||||
out.flush();
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ public class CommandFactory {
|
|||
}
|
||||
|
||||
public MIExecInterrupt createMIExecInterrupt() {
|
||||
return new MIExecInterrupt();
|
||||
return null;
|
||||
}
|
||||
|
||||
public MIExecNext createMIExecNext() {
|
||||
|
|
|
@ -40,6 +40,10 @@ public class MICommand extends Command {
|
|||
return operation;
|
||||
}
|
||||
|
||||
protected void setOperation(String op) {
|
||||
operation = op;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of command's options. An empty collection is
|
||||
* returned if there are no options.
|
||||
|
|
Loading…
Add table
Reference in a new issue