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 a565d4fbb8f..2e888ff7917 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 @@ -17,6 +17,7 @@ import org.eclipse.cdt.utils.spawner.ProcessFactory; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPluginDescriptor; import org.eclipse.core.runtime.Plugin; +import org.eclipse.core.runtime.Preferences; /** * GDB/MI Plugin. @@ -44,27 +45,36 @@ public class MIPlugin extends Plugin { /** * Method createMISession. * @param Process + * @param PTY + * @param int + * @param int + * @throws MIException * @return MISession */ - public MISession createMISession(Process process) throws MIException { - return new MISession(process); + public MISession createMISession(Process process, PTY pty, int timeout, int type) throws MIException { + return new MISession(process, pty, timeout, type); } /** * Method createMISession. * @param Process * @param PTY + * @param type + * @throws MIException * @return MISession */ - public MISession createMISession(Process process, PTY pty) throws MIException { - return new MISession(process, pty); + public MISession createMISession(Process process, PTY pty, int type) throws MIException { + MIPlugin plugin = getDefault(); + Preferences prefs = plugin.getPluginPreferences(); + int timeout = prefs.getInt(IMIConstants.PREF_REQUEST_TIMEOUT); + return createMISession(process, pty, timeout, 0); } /** * Method createCSession. * @param program * @return ICDISession - * @throws IOException + * @throws MIException */ public ICDISession createCSession(String gdb, String program) throws IOException, MIException { if (gdb == null || gdb.length() == 0) { @@ -84,7 +94,7 @@ public class MIPlugin extends Plugin { } Process pgdb = ProcessFactory.getFactory().exec(args); - MISession session = createMISession(pgdb, pty); + MISession session = createMISession(pgdb, pty, MISession.PROGRAM); // 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 { @@ -114,7 +124,7 @@ public class MIPlugin extends Plugin { } String[] args = new String[] {gdb, "--quiet", "-nw", "-i", "mi1", program, core}; Process pgdb = ProcessFactory.getFactory().exec(args); - MISession session = createMISession(pgdb); + MISession session = createMISession(pgdb, null, MISession.CORE); return new CSession(session); } @@ -131,7 +141,7 @@ public class MIPlugin extends Plugin { } String[] args = new String[] {gdb, "--quiet", "-nw", "-i", "mi1", program}; Process pgdb = ProcessFactory.getFactory().exec(args); - MISession session = createMISession(pgdb); + MISession session = createMISession(pgdb, null, MISession.ATTACH); try { CommandFactory factory = session.getCommandFactory(); MITargetAttach attach = factory.createMITargetAttach(pid); @@ -177,7 +187,13 @@ public class MIPlugin extends Plugin { */ public void startup() throws CoreException { super.startup(); - getPluginPreferences().setDefault( IMIConstants.PREF_REQUEST_TIMEOUT, IMIConstants.DEF_REQUEST_TIMEOUT ); + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.Plugin#initializeDefaultPluginPrefrences() + */ + protected void initializeDefaultPluginPreferences() { + getPluginPreferences().setDefault(IMIConstants.PREF_REQUEST_TIMEOUT, MISession.REQUEST_TIMEOUT); } /* (non-Javadoc)