mirror of https://github.com/mgba-emu/mgba.git
Debugger: Minor interface cleanup
This commit is contained in:
parent
bf595be5c3
commit
f96b08c52f
1
CHANGES
1
CHANGES
|
@ -116,6 +116,7 @@ Misc:
|
|||
- 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
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ static void _breakInto(struct CLIDebugger* debugger, struct CLIDebugVector* dv)
|
|||
|
||||
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 @@ static void _trace(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
|||
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 @@ static void _cliDebuggerCustom(struct mDebugger* debugger) {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,13 +50,14 @@ struct mDebugger* mDebuggerCreate(enum mDebuggerType type, struct mCore* core) {
|
|||
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 @@ void mDebuggerRun(struct mDebugger* debugger) {
|
|||
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);
|
||||
|
|
|
@ -205,7 +205,7 @@ static void _writeHostInfo(struct GDBStub* 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);
|
||||
|
|
|
@ -734,6 +734,7 @@ void* _GBGetMemoryBlock(struct mCore* core, size_t id, size_t* sizeOut) {
|
|||
static bool _GBCoreSupportsDebuggerType(struct mCore* core, enum mDebuggerType type) {
|
||||
UNUSED(core);
|
||||
switch (type) {
|
||||
case DEBUGGER_CUSTOM:
|
||||
case DEBUGGER_CLI:
|
||||
return true;
|
||||
default:
|
||||
|
|
|
@ -66,7 +66,7 @@ static bool _GBCLIDebuggerCustom(struct CLIDebuggerSystem* debugger) {
|
|||
|
||||
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;
|
||||
|
|
|
@ -819,12 +819,10 @@ void* _GBAGetMemoryBlock(struct mCore* core, size_t id, size_t* sizeOut) {
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ static bool _GBACLIDebuggerCustom(struct CLIDebuggerSystem* debugger) {
|
|||
|
||||
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;
|
||||
|
|
|
@ -56,7 +56,7 @@ class NativeDebugger(IRunner):
|
|||
|
||||
@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)
|
||||
|
|
Loading…
Reference in New Issue