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

For Windows try to set new-console, this is necessary

to get the inferior output non interlace with gdb output.
This commit is contained in:
Alain Magloire 2002-09-25 14:59:53 +00:00
parent 0753ee06e3
commit 3766b7446a

View file

@ -9,6 +9,7 @@ import java.io.IOException;
import org.eclipse.cdt.debug.core.cdi.ICDISession; import org.eclipse.cdt.debug.core.cdi.ICDISession;
import org.eclipse.cdt.debug.mi.core.cdi.CSession; import org.eclipse.cdt.debug.mi.core.cdi.CSession;
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.MIGDBSet;
import org.eclipse.cdt.debug.mi.core.command.MITargetAttach; import org.eclipse.cdt.debug.mi.core.command.MITargetAttach;
import org.eclipse.cdt.debug.mi.core.output.MIInfo; import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.cdt.utils.pty.PTY; import org.eclipse.cdt.utils.pty.PTY;
@ -75,28 +76,28 @@ public class MIPlugin extends Plugin {
try { try {
pty = new PTY(); pty = new PTY();
String ttyName = pty.getSlaveName(); String ttyName = pty.getSlaveName();
args = new String[] {gdb, "-q", "-nw", "-tty", ttyName, "-i", "mi", program}; args = new String[] {gdb, "-q", "-nw", "-tty", ttyName, "-i", "mi1", program};
} catch (IOException e) { } catch (IOException e) {
//e.printStackTrace(); //e.printStackTrace();
pty = null; pty = null;
args = new String[] {"gdb", "-q", "-nw", "-i", "mi", program}; args = new String[] {"gdb", "-q", "-nw", "-i", "mi1", program};
} }
Process pgdb = ProcessFactory.getFactory().exec(args); Process pgdb = ProcessFactory.getFactory().exec(args);
MISession session = createMISession(pgdb, pty); MISession session = createMISession(pgdb, pty);
/* // For windows we need to start the inferior in a new console window
// to separate the Inferior std{in,out,err} from gdb std{in,out,err}
try { try {
CommandFactory factory = session.getCommandFactory(); CommandFactory factory = session.getCommandFactory();
MIBreakInsert bkpt= factory.createMIBreakInsert(true, false, null, 0, "main"); MIGDBSet set = factory.createMIGDBSet(new String[]{"new-console"});
session.postCommand(bkpt); session.postCommand(set);
MIInfo info = bkpt.getMIInfo(); MIInfo info = set.getMIInfo();
if (info == null) { if (info == null) {
throw new IOException("No answer"); throw new IOException("No answer");
} }
} catch (MIException e) { } catch (MIException e) {
throw new IOException("Failed to attach"); //throw new IOException("Failed to attach");
} }
*/
return new CSession(session, false); return new CSession(session, false);
} }
@ -111,7 +112,7 @@ public class MIPlugin extends Plugin {
if (gdb == null || gdb.length() == 0) { if (gdb == null || gdb.length() == 0) {
gdb = "gdb"; gdb = "gdb";
} }
String[] args = new String[] {gdb, "--quiet", "-nw", "-i", "mi", program, core}; String[] args = new String[] {gdb, "--quiet", "-nw", "-i", "mi1", program, core};
Process pgdb = ProcessFactory.getFactory().exec(args); Process pgdb = ProcessFactory.getFactory().exec(args);
MISession session = createMISession(pgdb); MISession session = createMISession(pgdb);
return new CSession(session); return new CSession(session);
@ -128,7 +129,7 @@ public class MIPlugin extends Plugin {
if (gdb == null || gdb.length() == 0) { if (gdb == null || gdb.length() == 0) {
gdb = "gdb"; gdb = "gdb";
} }
String[] args = new String[] {gdb, "--quiet", "-nw", "-i", "mi", program}; String[] args = new String[] {gdb, "--quiet", "-nw", "-i", "mi1", program};
Process pgdb = ProcessFactory.getFactory().exec(args); Process pgdb = ProcessFactory.getFactory().exec(args);
MISession session = createMISession(pgdb); MISession session = createMISession(pgdb);
try { try {