[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] Guess suspended state.
|
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/ChangeLog,v
retrieving revision 1.66
diff -u -r1.66 ChangeLog
--- ChangeLog 17 Jan 2003 16:29:11 -0000 1.66
+++ ChangeLog 17 Jan 2003 18:32:17 -0000
@@ -1,3 +1,17 @@
+2003-01-17 Alain Magloire
+
+ The problem here is that we do not knw the state of
+ the session, for example "target remote server:port"
+ was issue, in this case the state is suspended.
+ We try to guess by posting a "info remote-process"
+ and set suspended when no error.
+
+ * src/.../mi/core/MIPlugin.java (createCSession):
+ Try "info remote-process" to guess the state.
+ Remove the "new-console" call to windows specific files.
+ * src/.../mi/core/CygwinGDBDebugger.java(createLaunchSession):
+ call "set new-console" for windows plaforms.
+
2003-01-16 Alain Magloire
* src/.../mi/core/cdi/SharedLibary.java (setMIShared):
Index: src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java,v
retrieving revision 1.3
diff -u -r1.3 CygwinGDBDebugger.java
--- src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java 3 Jan 2003 20:29:45 -0000 1.3
+++ src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java 17 Jan 2003 18:32:17 -0000
@@ -8,7 +8,10 @@
import org.eclipse.cdt.debug.core.cdi.CDIException;
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.CygwinCommandFactory;
+import org.eclipse.cdt.debug.mi.core.command.MIGDBSet;
+import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.debug.core.ILaunchConfiguration;
@@ -32,6 +35,21 @@
throws CDIException {
CSession session = (CSession) super.createLaunchSession(config, exe);
session.getMISession().setCommandFactory(commandFactory);
+ // 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}
+ MISession mi = session.getMISession();
+ try {
+ CommandFactory factory = mi.getCommandFactory();
+ MIGDBSet set = factory.createMIGDBSet(new String[]{"new-console"});
+ mi.postCommand(set);
+ MIInfo info = set.getMIInfo();
+ if (info == null) {
+ throw new MIException("No answer");
+ }
+ } catch (MIException e) {
+ // We ignore this exception, for example
+ // on GNU/Linux the new-console is an error.
+ }
return session;
}
Index: src/org/eclipse/cdt/debug/mi/core/MIPlugin.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java,v
retrieving revision 1.34
diff -u -r1.34 MIPlugin.java
--- src/org/eclipse/cdt/debug/mi/core/MIPlugin.java 17 Jan 2003 15:12:32 -0000 1.34
+++ src/org/eclipse/cdt/debug/mi/core/MIPlugin.java 17 Jan 2003 18:32:17 -0000
@@ -8,8 +8,8 @@
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.CLICommand;
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.MITargetSelect;
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
@@ -113,19 +113,20 @@
Process pgdb = ProcessFactory.getFactory().exec(args);
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 to detect if we have been attach via "target remote localhost:port"
+ // and set the state to be suspended.
try {
- CommandFactory factory = session.getCommandFactory();
- MIGDBSet set = factory.createMIGDBSet(new String[]{"new-console"});
- session.postCommand(set);
- MIInfo info = set.getMIInfo();
+ CLICommand cmd = new CLICommand("info remote-process");
+ session.postCommand(cmd);
+ MIInfo info = cmd.getMIInfo();
if (info == null) {
throw new MIException("No answer");
}
+ //@@@ We have to manually set the suspended state when we attach
+ session.getMIInferior().setSuspended();
} catch (MIException e) {
- // We ignore this exception, for example
- // on GNU/Linux the new-console is an error.
+ // If an exception is thrown that means ok
+ // we did not attach to any target.
}
return new CSession(session, false);
}