Implement a GDBSTUB Server #6

Merged
paoda merged 9 commits from gdbstub into main 2023-02-23 22:18:27 +00:00
1 changed files with 5 additions and 2 deletions
Showing only changes of commit 49706842af - Show all commits

View File

@ -199,15 +199,18 @@ pub const EmuThing = struct {
const cpu = self.cpu; const cpu = self.cpu;
const sched = self.scheduler; const sched = self.scheduler;
// Is true when we have executed one (1) instruction
var did_step: bool = false;
// TODO: How can I make it easier to keep this in lock-step with runFrame? // TODO: How can I make it easier to keep this in lock-step with runFrame?
while (true) { while (!did_step) {
if (!cpu.stepDmaTransfer()) { if (!cpu.stepDmaTransfer()) {
if (cpu.isHalted()) { if (cpu.isHalted()) {
// Fast-forward to next Event // Fast-forward to next Event
sched.tick = sched.queue.peek().?.tick; sched.tick = sched.queue.peek().?.tick;
} else { } else {
cpu.step(); cpu.step();
break; // this function won't return until we've actually stepped once did_step = true;
} }
} }