trying to improve resume after debug

This commit is contained in:
Jorj Bauer 2021-01-13 23:04:30 -05:00
parent 2f308ee163
commit 55703a0838
2 changed files with 12 additions and 8 deletions

View File

@ -73,13 +73,13 @@ Debugger::Debugger()
Debugger::~Debugger() Debugger::~Debugger()
{ {
struct _history *h = history; while (history) {
while (h) {
struct _history *n = history->next; struct _history *n = history->next;
free(h->msg); free(history->msg);
delete(h); delete(history);
h = n; history = n;
} }
history = NULL;
} }
bool getAddress(const char *buf, unsigned int *addrOut) bool getAddress(const char *buf, unsigned int *addrOut)

View File

@ -160,14 +160,21 @@ static struct timespec runCPU(struct timespec now)
// Run the CPU // Run the CPU
uint8_t executed = 0; uint8_t executed = 0;
bool debuggerWasActive = false;
if (debugger.active()) { if (debugger.active()) {
// With the debugger running, we need to single-step through // With the debugger running, we need to single-step through
// instructions. // instructions.
executed = g_cpu->Run(1); executed = g_cpu->Run(1);
debuggerWasActive = true;
} else { } else {
// Otherwise we can run a bunch of instructions at once to // Otherwise we can run a bunch of instructions at once to
// save on the overhead. // save on the overhead.
executed = g_cpu->Run(24); executed = g_cpu->Run(24);
if (debuggerWasActive) {
cpuClockInitialized = false;
g_cpu->cycles = 0;
debuggerWasActive = false;
}
} }
// The paddles need to be triggered in real-time on the CPU // The paddles need to be triggered in real-time on the CPU
@ -176,9 +183,6 @@ static struct timespec runCPU(struct timespec now)
if (debugger.active()) { if (debugger.active()) {
debugger.step(); debugger.step();
// reset time flags
cpuClockInitialized = false;
g_cpu->cycles = 0;
} }
if (send_rst) { if (send_rst) {