1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

The MISession take the type of session base on an

argument in the constructor.  Set this correctly
for post-mortem, attach, and regular program.

Define initializeDefaultPluginPreference.
This commit is contained in:
Alain Magloire 2002-10-09 01:57:54 +00:00
parent 0d8dcf74cc
commit 2d34891d15

View file

@ -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)