diff options
author | Alain Magloire | 2003-09-25 16:04:49 +0000 |
---|---|---|
committer | Alain Magloire | 2003-09-25 16:04:49 +0000 |
commit | fab806abb9c024c42e96e6d967b7bb94d22f92fd (patch) | |
tree | 60b0cf48d6cc7bb381cac8f3bc432b8d10534768 /debug | |
parent | 0b3617b29c809f7ad823d454020da0830efbed38 (diff) | |
download | org.eclipse.cdt-fab806abb9c024c42e96e6d967b7bb94d22f92fd.tar.gz org.eclipse.cdt-fab806abb9c024c42e96e6d967b7bb94d22f92fd.tar.xz org.eclipse.cdt-fab806abb9c024c42e96e6d967b7bb94d22f92fd.zip |
Fix for PR 43496
Diffstat (limited to 'debug')
-rw-r--r-- | debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java | 27 |
1 files changed, 24 insertions, 3 deletions
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 390f2310424..85cd7564747 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 @@ -132,7 +132,13 @@ public class MIPlugin extends Plugin { } Process pgdb = ProcessFactory.getFactory().exec(args); - MISession session = createMISession(pgdb, pty, MISession.PROGRAM); + MISession session; + try { + session = createMISession(pgdb, pty, MISession.PROGRAM); + } catch (MIException e) { + pgdb.destroy(); + throw e; + } // Try to detect if we have been attach via "target remote localhost:port" // and set the state to be suspended. try { @@ -140,6 +146,7 @@ public class MIPlugin extends Plugin { session.postCommand(cmd); MIInfo info = cmd.getMIInfo(); if (info == null) { + pgdb.destroy(); throw new MIException("No answer"); } //@@@ We have to manually set the suspended state when we attach @@ -175,7 +182,13 @@ public class MIPlugin extends Plugin { args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", "mi1", "-c", core.getAbsolutePath(), program.getAbsolutePath()}; } Process pgdb = ProcessFactory.getFactory().exec(args); - MISession session = createMISession(pgdb, null, MISession.CORE); + MISession session; + try { + session = createMISession(pgdb, null, MISession.CORE); + } catch (MIException e) { + pgdb.destroy(); + throw e; + } return new Session(session); } @@ -202,13 +215,20 @@ public class MIPlugin extends Plugin { args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", "mi1", program.getAbsolutePath()}; } Process pgdb = ProcessFactory.getFactory().exec(args); - MISession session = createMISession(pgdb, null, MISession.ATTACH); + MISession session; + try { + session = createMISession(pgdb, null, MISession.ATTACH); + } catch (MIException e) { + pgdb.destroy(); + throw e; + } CommandFactory factory = session.getCommandFactory(); if (targetParams != null && targetParams.length > 0) { MITargetSelect target = factory.createMITargetSelect(targetParams); session.postCommand(target); MIInfo info = target.getMIInfo(); if (info == null) { + pgdb.destroy(); throw new MIException("No answer"); } } @@ -217,6 +237,7 @@ public class MIPlugin extends Plugin { session.postCommand(attach); MIInfo info = attach.getMIInfo(); if (info == null) { + pgdb.destroy(); throw new MIException("No answer"); } } |