From 3bccbf3c161cf6ec361ecda8c2c31f3fb82685b5 Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Thu, 28 Nov 2002 16:20:02 +0000 Subject: [PATCH] runUntil --- debug/org.eclipse.cdt.debug.core/ChangeLog | 5 ++++ .../cdt/debug/core/cdi/model/ICDITarget.java | 11 ++++++- .../cdt/debug/core/cdi/model/ICDIThread.java | 9 ++++++ debug/org.eclipse.cdt.debug.mi.core/ChangeLog | 5 ++++ .../cdt/debug/mi/core/cdi/CTarget.java | 30 +++++++++++++++++++ .../cdt/debug/mi/core/cdi/CThread.java | 9 ++++++ 6 files changed, 68 insertions(+), 1 deletion(-) diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index 11ac9d65742..ec161a2d555 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,8 @@ +2002-11-27 Alain Magloire + + * src/org/eclipse/cdt/debug/core/cdi/model/ICDITarget.java (runUntil): new method. + * src/org/eclipse/cdt/debug/core/cdi/model/ICDIThread.java (runUntil): new method. + 2002-11-27 Mikhail Khodjaiants Typo in plugin.properties. diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/cdi/model/ICDITarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/cdi/model/ICDITarget.java index 0b5b4715763..b858bfbb3fc 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/cdi/model/ICDITarget.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/cdi/model/ICDITarget.java @@ -7,6 +7,7 @@ package org.eclipse.cdt.debug.core.cdi.model; import org.eclipse.cdt.debug.core.cdi.CDIException; +import org.eclipse.cdt.debug.core.cdi.ICDILocation; import org.eclipse.cdt.debug.core.cdi.ICDIRegisterObject; import org.eclipse.cdt.debug.core.cdi.ICDISession; @@ -202,7 +203,15 @@ public interface ICDITarget extends ICDIObject { * @throws CDIException if this method fails. Reasons include: */ void finish() throws CDIException; - + + /** + * Continues running until location is reached. Can only be called when the associated + * target is suspended. + * + * @throws CDIException if this method fails. Reasons include: + */ + void runUntil(ICDILocation location) throws CDIException; + /** * Returns the currently selected thread. * diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/cdi/model/ICDIThread.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/cdi/model/ICDIThread.java index 3b15078b541..e4d2bc079ef 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/cdi/model/ICDIThread.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/cdi/model/ICDIThread.java @@ -7,6 +7,7 @@ package org.eclipse.cdt.debug.core.cdi.model; import org.eclipse.cdt.debug.core.cdi.CDIException; +import org.eclipse.cdt.debug.core.cdi.ICDILocation; /** * @@ -116,6 +117,14 @@ public interface ICDIThread extends ICDIObject { */ void stepIntoInstruction() throws CDIException; + /** + * Continues running until location is reached. + * Can only be called when the associated thread is suspended. + * + * @throws CDIException if this method fails. Reasons include: + */ + void runUntil(ICDILocation location) throws CDIException; + /** * Continues running until just after function in the current * stack frame returns. Can only be called when the associated diff --git a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog index a579bd43c7b..b0c49dc1946 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog @@ -1,3 +1,8 @@ +2002-11-28 Alain Magloire + + * src/.../mi/core/cdi/CTarget.java (runUntil): new method implemented. + * src/.../mi/core/cdi/CThread.java (runUntil): new method implemented. + 2002-11-26 Doug Schaefer * src/.../mi/core/CygwinGDBDebugger.java: diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/CTarget.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/CTarget.java index a79f3035d1b..48f68430e18 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/CTarget.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/CTarget.java @@ -9,6 +9,7 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.cdt.debug.core.cdi.CDIException; +import org.eclipse.cdt.debug.core.cdi.ICDILocation; import org.eclipse.cdt.debug.core.cdi.ICDIRegisterObject; import org.eclipse.cdt.debug.core.cdi.ICDISession; import org.eclipse.cdt.debug.core.cdi.model.ICDIGlobalVariable; @@ -27,6 +28,7 @@ import org.eclipse.cdt.debug.mi.core.command.MIExecNextInstruction; import org.eclipse.cdt.debug.mi.core.command.MIExecRun; import org.eclipse.cdt.debug.mi.core.command.MIExecStep; import org.eclipse.cdt.debug.mi.core.command.MIExecStepInstruction; +import org.eclipse.cdt.debug.mi.core.command.MIExecUntil; import org.eclipse.cdt.debug.mi.core.command.MIInfoThreads; import org.eclipse.cdt.debug.mi.core.command.MITargetDetach; import org.eclipse.cdt.debug.mi.core.command.MIThreadSelect; @@ -423,6 +425,34 @@ public class CTarget implements ICDITarget { lastExecutionToken = finish.getToken(); } + /** + * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#runUntil(ICDILocation) + */ + public void runUntil(ICDILocation location) throws CDIException { + MISession mi = session.getMISession(); + CommandFactory factory = mi.getCommandFactory(); + String loc = ""; + if (location.getFile() != null) { + loc = location.getFile() + ":" + location.getLineNumber(); + } else if (location.getFunction() != null) { + loc = location.getFunction(); + } else if (location.getAddress() != 0) { + loc = "" + location.getAddress(); + } + MIExecUntil until = factory.createMIExecUntil(loc); + try { + mi.postCommand(until); + MIInfo info = until.getMIInfo(); + if (info == null) { + throw new CDIException("No answer"); + } + } catch (MIException e) { + throw new CDIException(e.getMessage()); + } + lastExecutionToken = until.getToken(); + + } + /** * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#evaluateExpressionToString(String) */ diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/CThread.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/CThread.java index fc93645a66f..7577a1107b1 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/CThread.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/CThread.java @@ -6,6 +6,7 @@ package org.eclipse.cdt.debug.mi.core.cdi; import org.eclipse.cdt.debug.core.cdi.CDIException; +import org.eclipse.cdt.debug.core.cdi.ICDILocation; import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; import org.eclipse.cdt.debug.core.cdi.model.ICDIThread; import org.eclipse.cdt.debug.mi.core.MIException; @@ -254,6 +255,14 @@ public class CThread extends CObject implements ICDIThread { getTarget().stepReturn(); } + /** + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#runUntil(ICDILocation) + */ + public void runUntil(ICDILocation location) throws CDIException { + getCTarget().setCurrentThread(this); + getTarget().runUntil(location); + } + /** * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#suspend() */