bugfix: breakpoints should only trigger once

updated watchpointmote method to return executable address, not wrapped in an object
This commit is contained in:
Fredrik Osterlind 2012-05-09 13:04:35 +02:00
parent 3dde89971c
commit 8fd51cd889
3 changed files with 18 additions and 8 deletions

View file

@ -573,9 +573,9 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc
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 */
@ -589,7 +589,7 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc
}
}
if (lineTable == null) {
return null;
return -1;
}
/* Match line number */
@ -603,10 +603,16 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc
}
}
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();

View file

@ -35,6 +35,7 @@ import java.awt.BorderLayout;
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;
@ -165,9 +166,9 @@ public class CodeUI extends JPanel {
/* 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);
@ -328,7 +329,10 @@ public class CodeUI extends JPanel {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
Rectangle r = codeEditor.modelToView(start);
if (r != null) {
codeEditor.scrollRectToVisible(codeEditor.modelToView(start));
}
} catch (BadLocationException e) {
}
}

View file

@ -70,6 +70,6 @@ public interface WatchpointMote extends Mote {
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);
}