From c35087d93c9f4f746991217d06f9d658688aae3b Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Tue, 16 Dec 2003 17:44:43 +0000 Subject: [PATCH] Fix for PR 48870: Terminate gdb if attach to process fails. --- debug/org.eclipse.cdt.debug.mi.core/ChangeLog | 6 ++++ .../eclipse/cdt/debug/mi/core/MIPlugin.java | 33 ++++++++++--------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog index 4a6ff2fa208..51ed6164637 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog @@ -1,3 +1,9 @@ +2003-12-16 Mikhail Khodjaiants + + Fix for PR 48870: Terminate gdb if attach to process fails. + + * src/org/eclipse/cdt/debug/mi/core/MIPlugin.java + 2003-12-09 Alain Magloire Do not try to interrupt if the target was suspended. 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 6a10f45e9f4..d7effcae677 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 @@ -258,23 +258,26 @@ public class MIPlugin extends Plugin { 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"); + try { + if (targetParams != null && targetParams.length > 0) { + MITargetSelect target = factory.createMITargetSelect(targetParams); + session.postCommand(target); + MIInfo info = target.getMIInfo(); + if (info == null) { + throw new MIException("No answer"); + } } - } - if (pid > 0) { - MITargetAttach attach = factory.createMITargetAttach(pid); - session.postCommand(attach); - MIInfo info = attach.getMIInfo(); - if (info == null) { - pgdb.destroy(); - throw new MIException("No answer"); + if (pid > 0) { + MITargetAttach attach = factory.createMITargetAttach(pid); + session.postCommand(attach); + MIInfo info = attach.getMIInfo(); + if (info == null) { + throw new MIException("No answer"); + } } + } catch (MIException e) { + pgdb.destroy(); + throw e; } //@@@ We have to manually set the suspended state when we attach session.getMIInferior().setSuspended();