Test: Allow ROM tester to be debugged

This commit is contained in:
Vicki Pfau 2023-11-24 22:27:43 -08:00
parent 569bc92b90
commit 63b18687f0
1 changed files with 27 additions and 0 deletions

View File

@ -139,6 +139,19 @@ int main(int argc, char * argv[]) {
goto loadError;
}
#ifdef USE_DEBUGGERS
struct mDebugger debugger;
mDebuggerInit(&debugger);
bool hasDebugger = mArgumentsApplyDebugger(&args, core, &debugger);
if (hasDebugger) {
mDebuggerAttach(&debugger, core);
mDebuggerEnter(&debugger, DEBUGGER_ENTER_MANUAL, NULL);
} else {
mDebuggerDeinit(&debugger);
}
#endif
core->reset(core);
mArgumentsApplyFileLoads(&args, core);
@ -152,11 +165,25 @@ int main(int argc, char * argv[]) {
savestate->close(savestate);
}
#ifdef USE_DEBUGGERS
if (hasDebugger) {
do {
mDebuggerRun(&debugger);
} while (!_dispatchExiting && debugger.state != DEBUGGER_SHUTDOWN);
} else
#endif
do {
core->runLoop(core);
} while (!_dispatchExiting);
core->unloadROM(core);
#ifdef USE_DEBUGGERS
if (hasDebugger) {
core->detachDebugger(core);
mDebuggerDeinit(&debugger);
}
#endif
cleanExit = true;
loadError: