From bdda5f1c290f96c27cff8a18bc33baa614c36632 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Thu, 21 Jan 2010 22:32:32 +0000 Subject: [PATCH] bugfix: rescheduling mspsim-based after breakpoint stops simulation + disabled automatic CLI "trace" at exceptions --- .../mspsim/src/se/sics/cooja/mspmote/MspMote.java | 12 +++++------- .../mspmote/plugins/MspBreakpointContainer.java | 3 +-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMote.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMote.java index f73ca00f8..090cbb577 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMote.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMote.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: MspMote.java,v 1.37 2009/12/14 13:22:57 fros4943 Exp $ + * $Id: MspMote.java,v 1.38 2010/01/21 22:32:32 fros4943 Exp $ */ package se.sics.cooja.mspmote; @@ -258,6 +258,7 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc this.myCpu = node.getCPU(); this.myCpu.setMonitorExec(true); + this.myCpu.setTrace(0); /* TODO Enable */ int[] memory = myCpu.getMemory(); logger.info("Loading ELF from: " + fileELF.getAbsolutePath()); @@ -322,7 +323,8 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc if (stopNextInstruction) { stopNextInstruction = false; - sendCLICommandAndPrint("trace 1000"); + /*sendCLICommandAndPrint("trace 1000");*/ /* TODO Enable */ + scheduleNextWakeup(t); throw new RuntimeException("MSPSim requested simulation stop"); } @@ -334,8 +336,6 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc throw new RuntimeException("Bad event ordering: " + lastExecute + " < " + t); } - /* TODO Poll mote interfaces? */ - /* Execute MSPSim-based mote */ /* TODO Try-catch overhead */ try { @@ -346,15 +346,13 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc } catch (EmulationException e) { if (e.getMessage().startsWith("Bad operation")) { /* Experimental: print program counter history */ - sendCLICommandAndPrint("trace 1000"); + /*sendCLICommandAndPrint("trace 1000");*/ /* TODO Enable */ } throw (RuntimeException) new RuntimeException("Emulated exception: " + e.getMessage()).initCause(e); } - /* TODO Poll mote interfaces? */ - /* Schedule wakeup */ if (nextExecute <= t) { throw new RuntimeException(t + ": MSPSim requested early wakeup: " + nextExecute); diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspBreakpointContainer.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspBreakpointContainer.java index d04834e7c..27c721615 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspBreakpointContainer.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspBreakpointContainer.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: MspBreakpointContainer.java,v 1.2 2009/06/17 13:06:55 fros4943 Exp $ + * $Id: MspBreakpointContainer.java,v 1.3 2010/01/21 22:32:32 fros4943 Exp $ */ package se.sics.cooja.mspmote.plugins; @@ -187,7 +187,6 @@ public class MspBreakpointContainer implements WatchpointMote { protected void signalBreakpointTrigger(MspBreakpoint b) { if (b.stopsSimulation() && mspMote.getSimulation().isRunning()) { /* Stop simulation immediately */ - mspMote.getSimulation().stopSimulation(); mspMote.stopNextInstruction(); }