Debugger: Minor interface cleanup

This commit is contained in:
Vicki Pfau 2020-01-09 18:31:48 -08:00
parent bf595be5c3
commit f96b08c52f
10 changed files with 15 additions and 15 deletions

View File

@ -116,6 +116,7 @@ Misc:
- GBA I/O: Stop logging several harmless invalid register reads - GBA I/O: Stop logging several harmless invalid register reads
- Debugger: Separate aliases from main commands - Debugger: Separate aliases from main commands
- Debugger: Print break-/watchpoint ID when breaking in CLI - Debugger: Print break-/watchpoint ID when breaking in CLI
- Debugger: Minor interface cleanup
- SDL: Use controller GUID instead of name - SDL: Use controller GUID instead of name
- SM83: Rename LR35902 to SM83 - SM83: Rename LR35902 to SM83
- Tools: Allow using threaded renderer in perf.py - Tools: Allow using threaded renderer in perf.py

View File

@ -20,17 +20,16 @@ extern const uint32_t DEBUGGER_ID;
enum mDebuggerType { enum mDebuggerType {
DEBUGGER_NONE = 0, DEBUGGER_NONE = 0,
DEBUGGER_CUSTOM,
DEBUGGER_CLI, DEBUGGER_CLI,
#ifdef USE_GDB_STUB
DEBUGGER_GDB, DEBUGGER_GDB,
#endif
DEBUGGER_MAX DEBUGGER_MAX
}; };
enum mDebuggerState { enum mDebuggerState {
DEBUGGER_PAUSED, DEBUGGER_PAUSED,
DEBUGGER_RUNNING, DEBUGGER_RUNNING,
DEBUGGER_CUSTOM, DEBUGGER_CALLBACK,
DEBUGGER_SHUTDOWN DEBUGGER_SHUTDOWN
}; };

View File

@ -155,7 +155,7 @@ static void _breakInto(struct CLIDebugger* debugger, struct CLIDebugVector* dv)
static void _continue(struct CLIDebugger* debugger, struct CLIDebugVector* dv) { static void _continue(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
UNUSED(dv); UNUSED(dv);
debugger->d.state = debugger->traceRemaining != 0 ? DEBUGGER_CUSTOM : DEBUGGER_RUNNING; debugger->d.state = debugger->traceRemaining != 0 ? DEBUGGER_CALLBACK : DEBUGGER_RUNNING;
} }
static void _next(struct CLIDebugger* debugger, struct CLIDebugVector* dv) { static void _next(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
@ -700,7 +700,7 @@ static void _trace(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
debugger->traceVf = VFileOpen(dv->next->charValue, O_CREAT | O_WRONLY | O_APPEND); debugger->traceVf = VFileOpen(dv->next->charValue, O_CREAT | O_WRONLY | O_APPEND);
} }
if (_doTrace(debugger)) { if (_doTrace(debugger)) {
debugger->d.state = DEBUGGER_CUSTOM; debugger->d.state = DEBUGGER_CALLBACK;
} else { } else {
debugger->system->printStatus(debugger->system); debugger->system->printStatus(debugger->system);
} }
@ -1043,7 +1043,7 @@ static void _cliDebuggerCustom(struct mDebugger* debugger) {
if (cliDebugger->system) { if (cliDebugger->system) {
retain = cliDebugger->system->custom(cliDebugger->system) && retain; retain = cliDebugger->system->custom(cliDebugger->system) && retain;
} }
if (!retain && debugger->state == DEBUGGER_CUSTOM) { if (!retain && debugger->state == DEBUGGER_CALLBACK) {
debugger->state = next; debugger->state = next;
} }
} }

View File

@ -50,13 +50,14 @@ struct mDebugger* mDebuggerCreate(enum mDebuggerType type, struct mCore* core) {
struct CLIDebuggerSystem* sys = core->cliDebuggerSystem(core); struct CLIDebuggerSystem* sys = core->cliDebuggerSystem(core);
CLIDebuggerAttachSystem(&debugger->cli, sys); CLIDebuggerAttachSystem(&debugger->cli, sys);
break; break;
#ifdef USE_GDB_STUB
case DEBUGGER_GDB: case DEBUGGER_GDB:
#ifdef USE_GDB_STUB
GDBStubCreate(&debugger->gdb); GDBStubCreate(&debugger->gdb);
GDBStubListen(&debugger->gdb, 2345, 0); GDBStubListen(&debugger->gdb, 2345, 0);
break; break;
#endif #endif
case DEBUGGER_NONE: case DEBUGGER_NONE:
case DEBUGGER_CUSTOM:
case DEBUGGER_MAX: case DEBUGGER_MAX:
free(debugger); free(debugger);
return 0; return 0;
@ -89,7 +90,7 @@ void mDebuggerRun(struct mDebugger* debugger) {
debugger->platform->checkBreakpoints(debugger->platform); debugger->platform->checkBreakpoints(debugger->platform);
} }
break; break;
case DEBUGGER_CUSTOM: case DEBUGGER_CALLBACK:
debugger->core->step(debugger->core); debugger->core->step(debugger->core);
debugger->platform->checkBreakpoints(debugger->platform); debugger->platform->checkBreakpoints(debugger->platform);
debugger->custom(debugger); debugger->custom(debugger);

View File

@ -205,7 +205,7 @@ static void _writeHostInfo(struct GDBStub* stub) {
} }
static void _continue(struct GDBStub* stub, const char* message) { static void _continue(struct GDBStub* stub, const char* message) {
stub->d.state = DEBUGGER_CUSTOM; stub->d.state = DEBUGGER_CALLBACK;
stub->untilPoll = GDB_STUB_INTERVAL; stub->untilPoll = GDB_STUB_INTERVAL;
// TODO: parse message // TODO: parse message
UNUSED(message); UNUSED(message);

View File

@ -734,6 +734,7 @@ void* _GBGetMemoryBlock(struct mCore* core, size_t id, size_t* sizeOut) {
static bool _GBCoreSupportsDebuggerType(struct mCore* core, enum mDebuggerType type) { static bool _GBCoreSupportsDebuggerType(struct mCore* core, enum mDebuggerType type) {
UNUSED(core); UNUSED(core);
switch (type) { switch (type) {
case DEBUGGER_CUSTOM:
case DEBUGGER_CLI: case DEBUGGER_CLI:
return true; return true;
default: default:

View File

@ -66,7 +66,7 @@ static bool _GBCLIDebuggerCustom(struct CLIDebuggerSystem* debugger) {
static void _frame(struct CLIDebugger* debugger, struct CLIDebugVector* dv) { static void _frame(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
UNUSED(dv); UNUSED(dv);
debugger->d.state = DEBUGGER_CUSTOM; debugger->d.state = DEBUGGER_CALLBACK;
struct GBCLIDebugger* gbDebugger = (struct GBCLIDebugger*) debugger->system; struct GBCLIDebugger* gbDebugger = (struct GBCLIDebugger*) debugger->system;
gbDebugger->frameAdvance = true; gbDebugger->frameAdvance = true;

View File

@ -819,12 +819,10 @@ void* _GBAGetMemoryBlock(struct mCore* core, size_t id, size_t* sizeOut) {
static bool _GBACoreSupportsDebuggerType(struct mCore* core, enum mDebuggerType type) { static bool _GBACoreSupportsDebuggerType(struct mCore* core, enum mDebuggerType type) {
UNUSED(core); UNUSED(core);
switch (type) { switch (type) {
case DEBUGGER_CUSTOM:
case DEBUGGER_CLI: case DEBUGGER_CLI:
return true;
#ifdef USE_GDB_STUB
case DEBUGGER_GDB: case DEBUGGER_GDB:
return true; return true;
#endif
default: default:
return false; return false;
} }

View File

@ -65,7 +65,7 @@ static bool _GBACLIDebuggerCustom(struct CLIDebuggerSystem* debugger) {
static void _frame(struct CLIDebugger* debugger, struct CLIDebugVector* dv) { static void _frame(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
UNUSED(dv); UNUSED(dv);
debugger->d.state = DEBUGGER_CUSTOM; debugger->d.state = DEBUGGER_CALLBACK;
struct GBACLIDebugger* gbaDebugger = (struct GBACLIDebugger*) debugger->system; struct GBACLIDebugger* gbaDebugger = (struct GBACLIDebugger*) debugger->system;
gbaDebugger->frameAdvance = true; gbaDebugger->frameAdvance = true;

View File

@ -56,7 +56,7 @@ class NativeDebugger(IRunner):
@property @property
def paused(self): def paused(self):
return self._native.state in (lib.DEBUGGER_PAUSED, lib.DEBUGGER_CUSTOM) return self._native.state in (lib.DEBUGGER_PAUSED, lib.DEBUGGER_CALLBACK)
def use_core(self): def use_core(self):
return DebuggerCoreOwner(self) return DebuggerCoreOwner(self)