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);
myMoteInterfaceHandler = createMoteInterfaceHandler(); if (myMoteInterfaceHandler == null) {
myMoteInterfaceHandler = createMoteInterfaceHandler();
}
/* Create watchpoint container */ /* Create watchpoint container */
try { try {
@ -497,18 +499,23 @@ 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();
if (mapEntry != null) { try {
String file = mapEntry.getFile(); MapEntry mapEntry = sp.getCallMapEntry(0);
if (file != null) { if (mapEntry != null) {
if (file.indexOf('/') >= 0) { String file = mapEntry.getFile();
file = file.substring(file.lastIndexOf('/')+1); if (file != null) {
if (file.indexOf('/') >= 0) {
file = file.substring(file.lastIndexOf('/')+1);
}
} }
String name = mapEntry.getName();
return file + ":?:" + name;
} }
String name = mapEntry.getName(); return String.format("*%02x", myCpu.reg[MSP430Constants.PC]);
return file + ":?:" + name; } catch (Exception e) {
return null;
} }
return String.format("*%02x", myCpu.reg[MSP430Constants.PC]);
} }
int lineNo = di.getLine(); int lineNo = di.getLine();