mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-02 13:55:39 +02:00
Send the output straighout to the GDB channel
This commit is contained in:
parent
7dfa13d225
commit
b184f762be
1 changed files with 6 additions and 17 deletions
|
@ -10,7 +10,6 @@ import java.io.OutputStream;
|
||||||
import java.io.PipedInputStream;
|
import java.io.PipedInputStream;
|
||||||
import java.io.PipedOutputStream;
|
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.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.MIGDBShowExitCode;
|
import org.eclipse.cdt.debug.mi.core.command.MIGDBShowExitCode;
|
||||||
|
@ -65,24 +64,14 @@ public class MIInferior extends Process {
|
||||||
out = new OutputStream() {
|
out = new OutputStream() {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
public void write(int b) throws IOException {
|
public void write(int b) throws IOException {
|
||||||
buf.append((char)b);
|
if (!isRunning()) {
|
||||||
if (b == '\n') {
|
throw new IOException("target is suspended");
|
||||||
flush();
|
|
||||||
}
|
}
|
||||||
|
OutputStream channel = session.getChannelOutputStream();
|
||||||
|
if (channel == null) {
|
||||||
|
throw new IOException("No MI Session");
|
||||||
}
|
}
|
||||||
// Encapsulate the string sent to gdb in a fake command.
|
channel.write(b);
|
||||||
// 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");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue