Breakkkkkkkpoints

This commit is contained in:
2024-06-02 22:36:33 +02:00
parent 0ed167f822
commit 7440329d91
2 changed files with 31 additions and 10 deletions

View File

@ -1,3 +1 @@
{ {"0":255}
}

View File

@ -46,6 +46,12 @@ public class Controller_Frontend {
return executionTimeMultiplier; return executionTimeMultiplier;
} }
private boolean isBreakpointReached = false;
private boolean continueExecutionAfterBreakpoint = false;
@ -139,10 +145,12 @@ public class Controller_Frontend {
@FXML @FXML
private void autoRunGUI(ActionEvent event) { public void autoRunGUI(ActionEvent event) {
if (!isAutoRunActive) { if (!isAutoRunActive) {
isAutoRunActive = true; isAutoRunActive = true;
initializeBreakpoints();
} }
Thread autoRunThread = new Thread(() -> { Thread autoRunThread = new Thread(() -> {
try { try {
while (DataRegister.getPC() < prog.length && isAutoRunActive){ while (DataRegister.getPC() < prog.length && isAutoRunActive){
@ -206,13 +214,21 @@ public class Controller_Frontend {
else else
currentIndex = ind[DataRegister.getPC()]-1; currentIndex = ind[DataRegister.getPC()]-1;
// Überprüfen, ob ein Breakpoint gesetzt ist testte // Überprüfung ob ein Breakpoint gesetzt ist testte
if (breakpoints.contains(currentIndex)) { if (breakpoints.contains(currentIndex)) {
stopAutoRun(null); if (breakpoints.contains(currentIndex) && !continueExecutionAfterBreakpoint){
System.out.println("Breakpoint erreicht bei Zeile: " + currentIndex); isBreakpointReached = true;
return; stopAutoRun(null);
System.out.println("Breakpoint erreicht bei Zeile: " + currentIndex);
continueExecutionAfterBreakpoint = true;
return;
}
} }
initializeBreakpoints();
// Scrollen zur ausgewählten Zeile // Scrollen zur ausgewählten Zeile
lstContentListView.scrollTo(currentIndex -2); lstContentListView.scrollTo(currentIndex -2);
@ -245,6 +261,7 @@ public class Controller_Frontend {
CreateWindow.refreshTable(stage); CreateWindow.refreshTable(stage);
IOPorts.refreshUI(getTRISbuttons(), getPORTbuttons()); IOPorts.refreshUI(getTRISbuttons(), getPORTbuttons());
long totalExecutionTime = Commands.getTotalExecutionTime(); long totalExecutionTime = Commands.getTotalExecutionTime();
totalExecutionTimeLabel.setText("Total Execution Time: " + totalExecutionTime + "µs"); totalExecutionTimeLabel.setText("Total Execution Time: " + totalExecutionTime + "µs");
} }
@ -264,6 +281,7 @@ public class Controller_Frontend {
}); });
} }
//////////////testeteet
private Set<Integer> breakpoints = new HashSet<>(); private Set<Integer> breakpoints = new HashSet<>();
@ -279,6 +297,7 @@ public class Controller_Frontend {
initialize(); initialize();
toggleLEDs(null); toggleLEDs(null);
IOPorts.reset(); IOPorts.reset();
for (ToggleButtonGroup toggleButtonGroup : allPORTbuttons) { for (ToggleButtonGroup toggleButtonGroup : allPORTbuttons) {
try { try {
toggleButtonGroup.getToggles().get(0).setSelected(true); toggleButtonGroup.getToggles().get(0).setSelected(true);
@ -286,6 +305,8 @@ public class Controller_Frontend {
IOPorts.setPORTfromUI(toggleButtonGroup); IOPorts.setPORTfromUI(toggleButtonGroup);
} catch (NullPointerException ignored) {} } catch (NullPointerException ignored) {}
} }
initializeBreakpoints();
breakpoints.clear();
IOPorts.refreshUI(getTRISbuttons(), getPORTbuttons()); IOPorts.refreshUI(getTRISbuttons(), getPORTbuttons());
Commands.resetTotalExecutionTime(); Commands.resetTotalExecutionTime();
WatchdogTimer.reset(); WatchdogTimer.reset();
@ -308,9 +329,11 @@ public class Controller_Frontend {
} }
Stage stage = (Stage) stepintoButton.getScene().getWindow(); Stage stage = (Stage) stepintoButton.getScene().getWindow();
stage.setTitle(stageTitle); stage.setTitle(stageTitle);
} }
} }
private void initializeBreakpoints() { private void initializeBreakpoints() {
@ -473,7 +496,7 @@ public class Controller_Frontend {
autoRunGUI.setOnAction(this::autoRunGUI); autoRunGUI.setOnAction(this::autoRunGUI);
stopButton.setOnAction(this::stopAutoRun); stopButton.setOnAction(this::stopAutoRun);
initializeBreakpoints();
executionTimeComboBox.setItems(FXCollections.observableArrayList("8 MHZ", "4 MHZ", "1 MHZ", "500 HZ", "100 HZ", "32 HZ")); executionTimeComboBox.setItems(FXCollections.observableArrayList("8 MHZ", "4 MHZ", "1 MHZ", "500 HZ", "100 HZ", "32 HZ"));
executionTimeComboBox.setValue("4 MHZ"); executionTimeComboBox.setValue("4 MHZ");
executionTimeComboBox.setOnAction(event -> updateExecutionTimeMultiplier()); executionTimeComboBox.setOnAction(event -> updateExecutionTimeMultiplier());