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