moved handling of breakpoint configs from plugin to mote

This commit is contained in:
fros4943 2009-06-15 09:44:42 +00:00
parent 61885eba09
commit 4fecf3fe1e
2 changed files with 34 additions and 14 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.30 2009/06/11 10:08:12 fros4943 Exp $ * $Id: MspMote.java,v 1.31 2009/06/15 09:44:42 fros4943 Exp $
*/ */
package se.sics.cooja.mspmote; package se.sics.cooja.mspmote;
@ -399,6 +399,8 @@ public abstract class MspMote implements Mote, WatchpointMote {
/* Create watchpoint container */ /* Create watchpoint container */
breakpointsContainer = new MspBreakpointContainer(this, getFirmwareDebugInfo(this)); breakpointsContainer = new MspBreakpointContainer(this, getFirmwareDebugInfo(this));
} else if ("breakpoints".equals(element.getName())) {
breakpointsContainer.setConfigXML(element.getChildren(), visAvailable);
} else if (name.equals("interface_config")) { } else if (name.equals("interface_config")) {
String intfClass = element.getText().trim(); String intfClass = element.getText().trim();
if (intfClass.equals("se.sics.cooja.mspmote.interfaces.MspIPAddress")) { if (intfClass.equals("se.sics.cooja.mspmote.interfaces.MspIPAddress")) {
@ -430,6 +432,11 @@ public abstract class MspMote implements Mote, WatchpointMote {
element.setText(getType().getIdentifier()); element.setText(getType().getIdentifier());
config.add(element); config.add(element);
/* Breakpoints */
element = new Element("breakpoints");
element.addContent(breakpointsContainer.getConfigXML());
config.add(element);
// Mote interfaces // Mote interfaces
for (MoteInterface moteInterface: getInterfaces().getInterfaces()) { for (MoteInterface moteInterface: getInterfaces().getInterfaces()) {
element = new Element("interface_config"); element = new Element("interface_config");

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: MspCodeWatcher.java,v 1.17 2009/06/11 10:12:44 fros4943 Exp $ * $Id: MspCodeWatcher.java,v 1.18 2009/06/15 09:44:42 fros4943 Exp $
*/ */
package se.sics.cooja.mspmote.plugins; package se.sics.cooja.mspmote.plugins;
@ -47,6 +47,7 @@ import org.jdom.Element;
import se.sics.cooja.*; import se.sics.cooja.*;
import se.sics.cooja.mspmote.MspMote; import se.sics.cooja.mspmote.MspMote;
import se.sics.cooja.mspmote.MspMoteType;
import se.sics.cooja.util.StringUtils; import se.sics.cooja.util.StringUtils;
import se.sics.mspsim.core.EmulationException; import se.sics.mspsim.core.EmulationException;
import se.sics.mspsim.core.MSP430; import se.sics.mspsim.core.MSP430;
@ -241,10 +242,28 @@ public class MspCodeWatcher extends VisPlugin {
public void closePlugin() { public void closePlugin() {
simulation.deleteObserver(simObserver); simulation.deleteObserver(simObserver);
/* Delete breakpoints */ // if (breakpoints.getBreakpoints().length == 0) {
while (breakpoints.getBreakpoints().length > 0) { // return;
breakpoints.removeBreakpoint(breakpoints.getBreakpoints()[0].getExecutableAddress()); // }
} //
// if (GUI.isVisualized()) {
// String s1 = "Remove";
// String s2 = "Keep";
// Object[] options = { s1, s2 };
// int n = JOptionPane.showOptionDialog(GUI.getTopParentContainer(),
// "Mote has " + breakpoints.getBreakpoints().length + " breakpoints." +
// "\nShould they be removed?",
// "Remove mote breakpoints?", JOptionPane.YES_NO_OPTION,
// JOptionPane.QUESTION_MESSAGE, null, options, s1);
// if (n != JOptionPane.YES_OPTION) {
// return;
// }
// }
//
// /* Remove all mote breakpoints */
// while (breakpoints.getBreakpoints().length > 0) {
// breakpoints.removeBreakpoint(breakpoints.getBreakpoints()[0].getExecutableAddress());
// }
} }
private void updateCurrentSourceCodeFile() { private void updateCurrentSourceCodeFile() {
@ -381,10 +400,6 @@ public class MspCodeWatcher extends VisPlugin {
Vector<Element> config = new Vector<Element>(); Vector<Element> config = new Vector<Element>();
Element element; Element element;
element = new Element("breakpoints");
element.addContent(breakpoints.getConfigXML());
config.add(element);
element = new Element("split_1"); element = new Element("split_1");
element.addContent("" + leftSplitPane.getDividerLocation()); element.addContent("" + leftSplitPane.getDividerLocation());
config.add(element); config.add(element);
@ -398,9 +413,7 @@ public class MspCodeWatcher extends VisPlugin {
public boolean setConfigXML(Collection<Element> configXML, boolean visAvailable) { public boolean setConfigXML(Collection<Element> configXML, boolean visAvailable) {
for (Element element : configXML) { for (Element element : configXML) {
if (element.getName().equals("breakpoints")) { if (element.getName().equals("split_1")) {
breakpoints.setConfigXML(element.getChildren(), visAvailable);
} else if (element.getName().equals("split_1")) {
leftSplitPane.setDividerLocation(Integer.parseInt(element.getText())); leftSplitPane.setDividerLocation(Integer.parseInt(element.getText()));
} else if (element.getName().equals("split_2")) { } else if (element.getName().equals("split_2")) {
rightSplitPane.setDividerLocation(Integer.parseInt(element.getText())); rightSplitPane.setDividerLocation(Integer.parseInt(element.getText()));