Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Implement jump/signal/finish/return

Index: src/org/eclipse/cdt/debug/mi/core/cdi/SignalManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/SignalManager.java,v
retrieving revision 1.12
diff -u -r1.12 SignalManager.java
--- src/org/eclipse/cdt/debug/mi/core/cdi/SignalManager.java	3 Feb 2003 22:26:53 -0000	1.12
+++ src/org/eclipse/cdt/debug/mi/core/cdi/SignalManager.java	4 Feb 2003 19:11:58 -0000
@@ -18,10 +18,8 @@
 import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
 import org.eclipse.cdt.debug.mi.core.command.MIHandle;
 import org.eclipse.cdt.debug.mi.core.command.MIInfoSignals;
-import org.eclipse.cdt.debug.mi.core.command.MISignal;
 import org.eclipse.cdt.debug.mi.core.event.MIEvent;
 import org.eclipse.cdt.debug.mi.core.event.MISignalChangedEvent;
-import org.eclipse.cdt.debug.mi.core.output.MIInfo;
 import org.eclipse.cdt.debug.mi.core.output.MIInfoSignalsInfo;
 import org.eclipse.cdt.debug.mi.core.output.MISigHandle;
 
@@ -198,25 +196,6 @@
 		MISession mi = session.getMISession();
 		MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]);
 		mi.fireEvents(events);
-	}
-
-	/**
-	 * Method signal.
-	 */
-	public void signal(ICDISignal sig) throws CDIException {
-		Session session = (Session)getSession();
-		MISession mi = session.getMISession();
-		CommandFactory factory = mi.getCommandFactory();
-		MISignal signal = factory.createMISignal(sig.getName());
-		try {
-			mi.postCommand(signal);
-			MIInfo info = signal.getMIInfo();
-			if (info == null) {
-				throw new CDIException("No answer");
-			}
-		} catch (MIException e) {
-			throw new MI2CDIException(e);
-		}
 	}
 
 } 
Index: src/org/eclipse/cdt/debug/mi/core/cdi/model/Signal.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Signal.java,v
retrieving revision 1.6
diff -u -r1.6 Signal.java
--- src/org/eclipse/cdt/debug/mi/core/cdi/model/Signal.java	3 Feb 2003 22:26:40 -0000	1.6
+++ src/org/eclipse/cdt/debug/mi/core/cdi/model/Signal.java	4 Feb 2003 19:12:01 -0000
@@ -70,6 +70,6 @@
 	 * Continue program giving it signal specified by the argument.
 	 */
 	public void signal() throws CDIException {
-		mgr.signal(this);
+		getTarget().signal(this);
 	}
 }
Index: src/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java,v
retrieving revision 1.4
diff -u -r1.4 Target.java
--- src/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java	31 Jan 2003 19:53:42 -0000	1.4
+++ src/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java	4 Feb 2003 19:12:01 -0000
@@ -15,6 +15,7 @@
 import org.eclipse.cdt.debug.core.cdi.model.ICDIRegister;
 import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterObject;
 import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
+import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
 import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
 import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
 import org.eclipse.cdt.debug.mi.core.MIException;
@@ -28,11 +29,14 @@
 import org.eclipse.cdt.debug.mi.core.command.MIExecFinish;
 import org.eclipse.cdt.debug.mi.core.command.MIExecNext;
 import org.eclipse.cdt.debug.mi.core.command.MIExecNextInstruction;
+import org.eclipse.cdt.debug.mi.core.command.MIExecReturn;
 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.MIJump;
+import org.eclipse.cdt.debug.mi.core.command.MISignal;
 import org.eclipse.cdt.debug.mi.core.command.MITargetDetach;
 import org.eclipse.cdt.debug.mi.core.command.MIThreadSelect;
 import org.eclipse.cdt.debug.mi.core.event.MIDetachedEvent;
@@ -420,6 +424,23 @@
 	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepReturn()
 	 */
 	public void stepReturn() throws CDIException {
+		stepReturn(true);
+	}
+
+	/**
+	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepReturn(boolean)
+	 */
+	public void stepReturn(boolean execute) throws CDIException {
+		if (execute) {
+			finish();
+		} else {
+			execReturn();
+		}
+	}
+
+	/**
+	 */
+	protected void finish() throws CDIException {
 		MISession mi = session.getMISession();
 		CommandFactory factory = mi.getCommandFactory();
 		MIExecFinish finish = factory.createMIExecFinish();
@@ -436,6 +457,24 @@
 	}
 
 	/**
+	 */
+	protected void execReturn() throws CDIException {
+		MISession mi = session.getMISession();
+		CommandFactory factory = mi.getCommandFactory();
+		MIExecReturn ret = factory.createMIExecReturn();
+		try {
+			mi.postCommand(ret);
+			MIInfo info = ret.getMIInfo();
+			if (info == null) {
+				throw new CDIException("No answer");
+			}
+		} catch (MIException e) {
+			throw new MI2CDIException(e);
+		}
+		lastExecutionToken = ret.getToken();
+	}
+
+	/**
 	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#suspend()
 	 */
 	public void suspend() throws CDIException {
@@ -472,28 +511,37 @@
 	}
 
 	/**
-	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#finish()
+	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#runUntil(ICDILocation)
 	 */
-	public void finish() throws CDIException {
+	public void runUntil(ICDILocation location) throws CDIException {
 		MISession mi = session.getMISession();
 		CommandFactory factory = mi.getCommandFactory();
-		MIExecFinish finish = factory.createMIExecFinish();
+		String loc = "";
+		if (location.getFile() != null && location.getFile().length() > 0) {
+			loc = location.getFile() + ":" + location.getLineNumber();
+		} else if (location.getFunction() != null && location.getFunction().length() > 0) {
+			loc = location.getFunction();
+		} else if (location.getAddress() != 0) {
+			loc = "*" + location.getAddress();
+		}
+		MIExecUntil until = factory.createMIExecUntil(loc);
 		try {
-			mi.postCommand(finish);
-			MIInfo info = finish.getMIInfo();
+			mi.postCommand(until);
+			MIInfo info = until.getMIInfo();
 			if (info == null) {
 				throw new CDIException("No answer");
 			}
 		} catch (MIException e) {
 			throw new MI2CDIException(e);
 		}
-		lastExecutionToken = finish.getToken();
+		lastExecutionToken = until.getToken();
+
 	}
 
 	/**
-	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#runUntil(ICDILocation)
+	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#jump(ICDILocation)
 	 */
-	public void runUntil(ICDILocation location) throws CDIException {
+	public void jump(ICDILocation location) throws CDIException {
 		MISession mi = session.getMISession();
 		CommandFactory factory = mi.getCommandFactory();
 		String loc = "";
@@ -504,18 +552,17 @@
 		} else if (location.getAddress() != 0) {
 			loc = "*" + location.getAddress();
 		}
-		MIExecUntil until = factory.createMIExecUntil(loc);
+		MIJump jump = factory.createMIJump(loc);
 		try {
-			mi.postCommand(until);
-			MIInfo info = until.getMIInfo();
+			mi.postCommand(jump);
+			MIInfo info = jump.getMIInfo();
 			if (info == null) {
 				throw new CDIException("No answer");
 			}
 		} catch (MIException e) {
 			throw new MI2CDIException(e);
 		}
-		lastExecutionToken = until.getToken();
-
+		lastExecutionToken = jump.getToken();
 	}
 
 	/**
@@ -606,6 +653,44 @@
 	 */
 	public Process getProcess() {
 		return session.getMISession().getMIInferior();
+	}
+
+	/**
+	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#signal()
+	 */
+	public void signal() throws CDIException {
+		Session session = (Session)getSession();
+		MISession mi = session.getMISession();
+		CommandFactory factory = mi.getCommandFactory();
+		MISignal signal = factory.createMISignal("0");
+		try {
+			mi.postCommand(signal);
+			MIInfo info = signal.getMIInfo();
+			if (info == null) {
+				throw new CDIException("No answer");
+			}
+		} catch (MIException e) {
+			throw new MI2CDIException(e);
+		}
+	}
+
+	/**
+	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#signal(ICDISignal)
+	 */
+	public void signal(ICDISignal signal) throws CDIException {
+		Session session = (Session)getSession();
+		MISession mi = session.getMISession();
+		CommandFactory factory = mi.getCommandFactory();
+		MISignal sig = factory.createMISignal(signal.getName());
+		try {
+			mi.postCommand(sig);
+			MIInfo info = sig.getMIInfo();
+			if (info == null) {
+				throw new CDIException("No answer");
+			}
+		} catch (MIException e) {
+			throw new MI2CDIException(e);
+		}
 	}
 
 }
Index: src/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java,v
retrieving revision 1.2
diff -u -r1.2 Thread.java
--- src/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java	29 Jan 2003 02:56:48 -0000	1.2
+++ src/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java	4 Feb 2003 19:11:59 -0000
@@ -7,6 +7,7 @@
 
 import org.eclipse.cdt.debug.core.cdi.CDIException;
 import org.eclipse.cdt.debug.core.cdi.ICDILocation;
+import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
 import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
 import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
 import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
@@ -231,14 +232,6 @@
 	}
 
 	/**
-	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#finish()
-	 */
-	public void finish() throws CDIException {
-		getTarget().setCurrentThread(this);
-		getTarget().finish();
-	}
-
-	/**
 	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#resume()
 	 */
 	public void resume() throws CDIException {
@@ -287,6 +280,14 @@
 	}
 
 	/**
+	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepReturn(boolean)
+	 */
+	public void stepReturn(boolean execute) throws CDIException {
+		getTarget().setCurrentThread(this);
+		getTarget().stepReturn(execute);
+	}
+
+	/**
 	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#runUntil(ICDILocation)
 	 */
 	public void runUntil(ICDILocation location) throws CDIException {
@@ -300,6 +301,30 @@
 	public void suspend() throws CDIException {
 		getTarget().setCurrentThread(this);
 		getTarget().suspend();
+	}
+
+	/**
+	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#jump(org.eclipse.cdt.debug.core.cdi.ICDILocation)
+	 */
+	public void jump(ICDILocation location) throws CDIException {
+		getTarget().setCurrentThread(this);
+		getTarget().jump(location);
+	}
+
+	/**
+	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#signal()
+	 */
+	public void signal() throws CDIException {
+		getTarget().setCurrentThread(this);
+		getTarget().signal();
+	}
+
+	/**
+	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#signal(org.eclipse.cdt.debug.core.cdi.model.ICDISignal)
+	 */
+	public void signal(ICDISignal signal) throws CDIException {
+		getTarget().setCurrentThread(this);
+		getTarget().signal(signal);
 	}
 
 	/**
Index: src/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java,v
retrieving revision 1.22
diff -u -r1.22 CommandFactory.java
--- src/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java	3 Feb 2003 22:27:04 -0000	1.22
+++ src/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java	4 Feb 2003 19:11:57 -0000
@@ -157,6 +157,10 @@
 		return new MIExecUntil(location);
 	}
 
+	public MIJump createMIJump(String location) {
+		return new MIJump(location);
+	}
+
 	public MIFileExecFile createMIFileExecFile(String file) {
 		return new MIFileExecFile(file);
 	}
Index: src/org/eclipse/cdt/debug/mi/core/command/MIJump.java
===================================================================
RCS file: src/org/eclipse/cdt/debug/mi/core/command/MIJump.java
diff -N src/org/eclipse/cdt/debug/mi/core/command/MIJump.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/debug/mi/core/command/MIJump.java	4 Feb 2003 19:11:56 -0000
@@ -0,0 +1,21 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ * 
+ */
+
+package org.eclipse.cdt.debug.mi.core.command;
+
+
+/**
+ * 
+ *    jump LINESPEC
+ *
+ */
+public class MIJump extends CLICommand {
+
+	public MIJump(String loc) {
+		super("jump " + loc);
+	}
+
+}



Back to the top