bugfix: rescheduling mspsim-based after breakpoint stops simulation + disabled automatic CLI "trace" at exceptions

This commit is contained in:
fros4943 2010-01-21 22:32:32 +00:00
parent fa5f1f73ab
commit bdda5f1c29
2 changed files with 6 additions and 9 deletions

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * 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; package se.sics.cooja.mspmote;
@ -258,6 +258,7 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc
this.myCpu = node.getCPU(); this.myCpu = node.getCPU();
this.myCpu.setMonitorExec(true); this.myCpu.setMonitorExec(true);
this.myCpu.setTrace(0); /* TODO Enable */
int[] memory = myCpu.getMemory(); int[] memory = myCpu.getMemory();
logger.info("Loading ELF from: " + fileELF.getAbsolutePath()); logger.info("Loading ELF from: " + fileELF.getAbsolutePath());
@ -322,7 +323,8 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc
if (stopNextInstruction) { if (stopNextInstruction) {
stopNextInstruction = false; stopNextInstruction = false;
sendCLICommandAndPrint("trace 1000"); /*sendCLICommandAndPrint("trace 1000");*/ /* TODO Enable */
scheduleNextWakeup(t);
throw new RuntimeException("MSPSim requested simulation stop"); 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); throw new RuntimeException("Bad event ordering: " + lastExecute + " < " + t);
} }
/* TODO Poll mote interfaces? */
/* Execute MSPSim-based mote */ /* Execute MSPSim-based mote */
/* TODO Try-catch overhead */ /* TODO Try-catch overhead */
try { try {
@ -346,15 +346,13 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc
} catch (EmulationException e) { } catch (EmulationException e) {
if (e.getMessage().startsWith("Bad operation")) { if (e.getMessage().startsWith("Bad operation")) {
/* Experimental: print program counter history */ /* Experimental: print program counter history */
sendCLICommandAndPrint("trace 1000"); /*sendCLICommandAndPrint("trace 1000");*/ /* TODO Enable */
} }
throw (RuntimeException) throw (RuntimeException)
new RuntimeException("Emulated exception: " + e.getMessage()).initCause(e); new RuntimeException("Emulated exception: " + e.getMessage()).initCause(e);
} }
/* TODO Poll mote interfaces? */
/* Schedule wakeup */ /* Schedule wakeup */
if (nextExecute <= t) { if (nextExecute <= t) {
throw new RuntimeException(t + ": MSPSim requested early wakeup: " + nextExecute); throw new RuntimeException(t + ": MSPSim requested early wakeup: " + nextExecute);

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * 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; package se.sics.cooja.mspmote.plugins;
@ -187,7 +187,6 @@ public class MspBreakpointContainer implements WatchpointMote {
protected void signalBreakpointTrigger(MspBreakpoint b) { protected void signalBreakpointTrigger(MspBreakpoint b) {
if (b.stopsSimulation() && mspMote.getSimulation().isRunning()) { if (b.stopsSimulation() && mspMote.getSimulation().isRunning()) {
/* Stop simulation immediately */ /* Stop simulation immediately */
mspMote.getSimulation().stopSimulation();
mspMote.stopNextInstruction(); mspMote.stopNextInstruction();
} }