diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java index 490b063aa6b..eed92965d22 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java @@ -11,6 +11,7 @@ import java.io.OutputStream; import org.eclipse.cdt.debug.core.cdi.ICDISession; 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.MIBreakInsert; import org.eclipse.cdt.debug.mi.core.command.MITargetAttach; import org.eclipse.cdt.debug.mi.core.output.MIInfo; import org.eclipse.core.runtime.IPluginDescriptor; @@ -50,6 +51,19 @@ public class MIPlugin extends Plugin { String[]args = new String[]{"gdb", "--quiet", "-i", "mi", program}; Process gdb = Runtime.getRuntime().exec(args); MISession session = createMISession(gdb.getInputStream(), gdb.getOutputStream()); + /* + try { + CommandFactory factory = session.getCommandFactory(); + MIBreakInsert bkpt= factory.createMIBreakInsert(true, false, null, 0, "main"); + session.postCommand(bkpt); + MIInfo info = bkpt.getMIInfo(); + if (info == null) { + throw new IOException("Timedout"); + } + } catch (MIException e) { + throw new IOException("Failed to attach"); + } + */ return new CSession(session); } @@ -70,7 +84,7 @@ public class MIPlugin extends Plugin { session.postCommand(attach); MIInfo info = attach.getMIInfo(); if (info == null) { - throw new IOException("Failed to attach"); + throw new IOException("Timedout"); } } catch (MIException e) { throw new IOException("Failed to attach"); @@ -79,9 +93,9 @@ public class MIPlugin extends Plugin { } public static void debugLog(String message) { - if ( getDefault().isDebugging() ) { + // if ( getDefault().isDebugging() ) { // getDefault().getLog().log(StatusUtil.newStatus(Status.ERROR, message, null)); System.err.println(message); - } + // } } } diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MISession.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MISession.java index 11444f31bc6..683162692a3 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MISession.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MISession.java @@ -156,6 +156,7 @@ public class MISession extends Observable { */ public void postCommand(Command cmd, long timeout) throws MIException { + MIPlugin.getDefault().debugLog(cmd.toString()); if (!txThread.isAlive() || !rxThread.isAlive()) { throw new MIException("{R,T}xThread terminated"); } diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/RxThread.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/RxThread.java index e24a60f6637..351ca339b00 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/RxThread.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/RxThread.java @@ -73,6 +73,7 @@ public class RxThread extends Thread { // at least for testing. // We accumulate until we see the gdb terminator. +MIPlugin.getDefault().debugLog(line); if (line.startsWith(MIOutput.terminator)) { // discard termination processMIOutput(buffer.toString());