all repos — mgba @ f96b08c52f6effe8cb882a2f4cf7b03c1dfec38e

mGBA Game Boy Advance Emulator

Debugger: Minor interface cleanup
Vicki Pfau vi@endrift.com
Thu, 09 Jan 2020 18:31:48 -0800
commit

f96b08c52f6effe8cb882a2f4cf7b03c1dfec38e

parent

bf595be5c3fda6c84a9b7468b3bcce812596b355

M CHANGESCHANGES

@@ -116,6 +116,7 @@ - GBA Audio: Redo channel 4 batching for GBA only

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

@@ -20,17 +20,16 @@ extern const uint32_t DEBUGGER_ID;

enum mDebuggerType { DEBUGGER_NONE = 0, + DEBUGGER_CUSTOM, DEBUGGER_CLI, -#ifdef USE_GDB_STUB DEBUGGER_GDB, -#endif DEBUGGER_MAX }; enum mDebuggerState { DEBUGGER_PAUSED, DEBUGGER_RUNNING, - DEBUGGER_CUSTOM, + DEBUGGER_CALLBACK, DEBUGGER_SHUTDOWN };
M src/debugger/cli-debugger.csrc/debugger/cli-debugger.c

@@ -155,7 +155,7 @@ #endif

static void _continue(struct CLIDebugger* debugger, struct CLIDebugVector* 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) {

@@ -700,7 +700,7 @@ if (dv->next && dv->next->charValue) {

debugger->traceVf = VFileOpen(dv->next->charValue, O_CREAT | O_WRONLY | O_APPEND); } if (_doTrace(debugger)) { - debugger->d.state = DEBUGGER_CUSTOM; + debugger->d.state = DEBUGGER_CALLBACK; } else { debugger->system->printStatus(debugger->system); }

@@ -1043,7 +1043,7 @@ }

if (cliDebugger->system) { retain = cliDebugger->system->custom(cliDebugger->system) && retain; } - if (!retain && debugger->state == DEBUGGER_CUSTOM) { + if (!retain && debugger->state == DEBUGGER_CALLBACK) { debugger->state = next; } }
M src/debugger/debugger.csrc/debugger/debugger.c

@@ -50,13 +50,14 @@ CLIDebuggerCreate(&debugger->cli);

struct CLIDebuggerSystem* sys = core->cliDebuggerSystem(core); CLIDebuggerAttachSystem(&debugger->cli, sys); break; -#ifdef USE_GDB_STUB case DEBUGGER_GDB: +#ifdef USE_GDB_STUB GDBStubCreate(&debugger->gdb); GDBStubListen(&debugger->gdb, 2345, 0); break; #endif case DEBUGGER_NONE: + case DEBUGGER_CUSTOM: case DEBUGGER_MAX: free(debugger); return 0;

@@ -89,7 +90,7 @@ debugger->core->step(debugger->core);

debugger->platform->checkBreakpoints(debugger->platform); } break; - case DEBUGGER_CUSTOM: + case DEBUGGER_CALLBACK: debugger->core->step(debugger->core); debugger->platform->checkBreakpoints(debugger->platform); debugger->custom(debugger);
M src/debugger/gdb-stub.csrc/debugger/gdb-stub.c

@@ -205,7 +205,7 @@ _sendMessage(stub);

} static void _continue(struct GDBStub* stub, const char* message) { - stub->d.state = DEBUGGER_CUSTOM; + stub->d.state = DEBUGGER_CALLBACK; stub->untilPoll = GDB_STUB_INTERVAL; // TODO: parse message UNUSED(message);
M src/gb/core.csrc/gb/core.c

@@ -734,6 +734,7 @@ #ifdef USE_DEBUGGERS

static bool _GBCoreSupportsDebuggerType(struct mCore* core, enum mDebuggerType type) { UNUSED(core); switch (type) { + case DEBUGGER_CUSTOM: case DEBUGGER_CLI: return true; default:
M src/gb/debugger/cli.csrc/gb/debugger/cli.c

@@ -66,7 +66,7 @@ }

static void _frame(struct CLIDebugger* debugger, struct CLIDebugVector* dv) { UNUSED(dv); - debugger->d.state = DEBUGGER_CUSTOM; + debugger->d.state = DEBUGGER_CALLBACK; struct GBCLIDebugger* gbDebugger = (struct GBCLIDebugger*) debugger->system; gbDebugger->frameAdvance = true;
M src/gba/core.csrc/gba/core.c

@@ -819,12 +819,10 @@ #ifdef USE_DEBUGGERS

static bool _GBACoreSupportsDebuggerType(struct mCore* core, enum mDebuggerType type) { UNUSED(core); switch (type) { + case DEBUGGER_CUSTOM: case DEBUGGER_CLI: - return true; -#ifdef USE_GDB_STUB case DEBUGGER_GDB: return true; -#endif default: return false; }
M src/gba/debugger/cli.csrc/gba/debugger/cli.c

@@ -65,7 +65,7 @@ }

static void _frame(struct CLIDebugger* debugger, struct CLIDebugVector* dv) { UNUSED(dv); - debugger->d.state = DEBUGGER_CUSTOM; + debugger->d.state = DEBUGGER_CALLBACK; struct GBACLIDebugger* gbaDebugger = (struct GBACLIDebugger*) debugger->system; gbaDebugger->frameAdvance = true;
M src/platform/python/mgba/debugger.pysrc/platform/python/mgba/debugger.py

@@ -56,7 +56,7 @@ return self._native.state == lib.DEBUGGER_RUNNING

@property 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): return DebuggerCoreOwner(self)