bugfix: mspsim may not have pc information, causing exception in buffer listener

bugfix: mote interfaces were incorrectly initialized twice, causing an mote id error in tinyos
This commit is contained in:
Fredrik Osterlind 2012-03-06 09:23:29 +01:00
parent ea42d590ea
commit e22bf837fc

View File

@ -387,7 +387,9 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc
public boolean setConfigXML(Simulation simulation, Collection<Element> configXML, boolean visAvailable) { public boolean setConfigXML(Simulation simulation, Collection<Element> configXML, boolean visAvailable) {
setSimulation(simulation); setSimulation(simulation);
if (myMoteInterfaceHandler == null) {
myMoteInterfaceHandler = createMoteInterfaceHandler(); myMoteInterfaceHandler = createMoteInterfaceHandler();
}
/* Create watchpoint container */ /* Create watchpoint container */
try { try {
@ -497,7 +499,9 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc
} }
if (di == null) { if (di == null) {
/* Return PC value */ /* Return PC value */
MapEntry mapEntry = ((SimpleProfiler)myCpu.getProfiler()).getCallMapEntry(0); SimpleProfiler sp = (SimpleProfiler)myCpu.getProfiler();
try {
MapEntry mapEntry = sp.getCallMapEntry(0);
if (mapEntry != null) { if (mapEntry != null) {
String file = mapEntry.getFile(); String file = mapEntry.getFile();
if (file != null) { if (file != null) {
@ -509,6 +513,9 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc
return file + ":?:" + name; return file + ":?:" + name;
} }
return String.format("*%02x", myCpu.reg[MSP430Constants.PC]); return String.format("*%02x", myCpu.reg[MSP430Constants.PC]);
} catch (Exception e) {
return null;
}
} }
int lineNo = di.getLine(); int lineNo = di.getLine();