1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-01 13:25:45 +02:00

Send the output straighout to the GDB channel

This commit is contained in:
Alain Magloire 2003-07-10 19:24:55 +00:00
parent 7dfa13d225
commit b184f762be

View file

@ -10,7 +10,6 @@ import java.io.OutputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
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.MIExecAbort;
import org.eclipse.cdt.debug.mi.core.command.MIGDBShowExitCode;
@ -65,24 +64,14 @@ public class MIInferior extends Process {
out = new OutputStream() {
StringBuffer buf = new StringBuffer();
public void write(int b) throws IOException {
buf.append((char)b);
if (b == '\n') {
flush();
if (!isRunning()) {
throw new IOException("target is suspended");
}
}
// Encapsulate the string sent to gdb in a fake command.
// and post it to the TxThread.
public void flush() throws IOException {
CLICommand cmd = new CLICommand(buf.toString()) {
public void setToken(int token) {
// override to do nothing;
}
};
try {
session.postCommand(cmd);
} catch (MIException e) {
throw new IOException("no mi session");
OutputStream channel = session.getChannelOutputStream();
if (channel == null) {
throw new IOException("No MI Session");
}
channel.write(b);
}
};
}