Commits

Fredrik Osterlind  committed 8fd51cd

bugfix: breakpoints should only trigger once

updated watchpointmote method to return executable address, not wrapped in an object

  • Participants
  • Parent commits 3dde899

Comments (0)

Files changed (3)

File tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMote.java

     return false;
   }
 
-  public Integer getExecutableAddressOf(File file, int lineNr) {
+  public int getExecutableAddressOf(File file, int lineNr) {
     if (file == null || lineNr < 0 || debuggingInfo == null) {
-      return null;
+      return -1;
     }
 
     /* Match file */
       }
     }
     if (lineTable == null) {
-      return null;
+      return -1;
     }
 
     /* Match line number */
       }
     }
 
-    return null;
+    return -1;
   }
 
+  private long lastBreakpointCycles = -1;
   public void signalBreakpointTrigger(MspBreakpoint b) {
+    if (lastBreakpointCycles == myCpu.cycles) {
+      return;
+    }
+
+    lastBreakpointCycles = myCpu.cycles;
     if (b.stopsSimulation() && getSimulation().isRunning()) {
       /* Stop simulation immediately */
       stopNextInstruction();

File tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/CodeUI.java

 import java.awt.Color;
 import java.awt.Component;
 import java.awt.Point;
+import java.awt.Rectangle;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.HashMap;
         /* Configure breakpoint menu options */
         /* XXX TODO We should ask for the file specified in the firmware, not
          * the actual file on disk. */
-        Integer address =
+        int address =
           CodeUI.this.mote.getExecutableAddressOf(displayedFile, line);
-        if (address == null) {
+        if (address < 0) {
           return;
         }
         final int start = codeEditorLines.get(line);
         SwingUtilities.invokeLater(new Runnable() {
           public void run() {
             try {
-              codeEditor.scrollRectToVisible(codeEditor.modelToView(start));
+              Rectangle r = codeEditor.modelToView(start);
+              if (r != null) {
+                codeEditor.scrollRectToVisible(codeEditor.modelToView(start));
+              }
             } catch (BadLocationException e) {
             }
           }

File tools/cooja/java/se/sics/cooja/WatchpointMote.java

   public boolean breakpointExists(int address);
   public boolean breakpointExists(File file, int lineNr);
 
-  public Integer getExecutableAddressOf(File file, int lineNr);
+  public int getExecutableAddressOf(File file, int lineNr);
 
 }