1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-21 16:05:25 +02:00

let throw MIException in createSession

This commit is contained in:
David Inglis 2002-11-01 15:04:43 +00:00
parent 2d39f23eee
commit 075e29a48e
2 changed files with 24 additions and 28 deletions

View file

@ -1,3 +1,7 @@
2002-11-1 David Inglis
* src/.../mi/core/MIPlugin.java
throw MIExceptions in createSession (not rethorwn IOExceptions)
2002-10-30 Alain Magloire 2002-10-30 Alain Magloire
* src/.../core/cdi/MemoryBlock.java (setDirty): When need a * src/.../core/cdi/MemoryBlock.java (setDirty): When need a

View file

@ -115,16 +115,12 @@ public class MIPlugin extends Plugin {
MISession session = createMISession(pgdb, pty, MISession.PROGRAM); MISession session = createMISession(pgdb, pty, MISession.PROGRAM);
// For windows we need to start the inferior in a new console window // 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} // to separate the Inferior std{in,out,err} from gdb std{in,out,err}
try { CommandFactory factory = session.getCommandFactory();
CommandFactory factory = session.getCommandFactory(); MIGDBSet set = factory.createMIGDBSet(new String[]{"new-console"});
MIGDBSet set = factory.createMIGDBSet(new String[]{"new-console"}); session.postCommand(set);
session.postCommand(set); MIInfo info = set.getMIInfo();
MIInfo info = set.getMIInfo(); if (info == null) {
if (info == null) { throw new MIException("No answer");
throw new IOException("No answer");
}
} catch (MIException e) {
//throw new IOException("Failed to attach");
} }
return new CSession(session, false); return new CSession(session, false);
} }
@ -161,27 +157,23 @@ public class MIPlugin extends Plugin {
Process pgdb = ProcessFactory.getFactory().exec(args); Process pgdb = ProcessFactory.getFactory().exec(args);
MISession session = createMISession(pgdb, null, MISession.ATTACH); MISession session = createMISession(pgdb, null, MISession.ATTACH);
MIInfo info = null; MIInfo info = null;
try { CommandFactory factory = session.getCommandFactory();
CommandFactory factory = session.getCommandFactory(); if (targetParams != null && targetParams.length > 0) {
if (targetParams != null && targetParams.length > 0) { MITargetSelect target = factory.createMITargetSelect(targetParams);
MITargetSelect target = factory.createMITargetSelect(targetParams); session.postCommand(target);
session.postCommand(target); info = target.getMIInfo();
info = target.getMIInfo();
if (info == null) {
throw new IOException("No answer");
}
}
MITargetAttach attach = factory.createMITargetAttach(pid);
session.postCommand(attach);
info = attach.getMIInfo();
if (info == null) { if (info == null) {
throw new IOException("No answer"); throw new MIException("No answer");
} }
//@@@ We have to manually set the suspended state when we attach
session.getMIInferior().setSuspended();
} catch (MIException e) {
throw new IOException("Failed to attach");
} }
MITargetAttach attach = factory.createMITargetAttach(pid);
session.postCommand(attach);
info = attach.getMIInfo();
if (info == null) {
throw new MIException("No answer");
}
//@@@ We have to manually set the suspended state when we attach
session.getMIInferior().setSuspended();
return new CSession(session, true); return new CSession(session, true);
} }