mirror of https://github.com/mgba-emu/mgba.git
DS: Add ability to switch CPUs while debugging
This commit is contained in:
parent
36b3f07ed1
commit
7969bac2b2
|
@ -38,7 +38,7 @@ static bool _DSCoreInit(struct mCore* core) {
|
|||
free(ds);
|
||||
return false;
|
||||
}
|
||||
core->cpu = arm7;
|
||||
core->cpu = arm9;
|
||||
core->board = ds;
|
||||
core->debugger = NULL;
|
||||
dscore->arm7 = arm7;
|
||||
|
@ -343,9 +343,6 @@ static void _DSCoreAttachDebugger(struct mCore* core, struct mDebugger* debugger
|
|||
DSDetachDebugger(core->board);
|
||||
}
|
||||
DSAttachDebugger(core->board, debugger);
|
||||
struct ARMCore* cpu = core->cpu;
|
||||
cpu->components[CPU_COMPONENT_DEBUGGER] = &debugger->d;
|
||||
ARMHotplugAttach(cpu, CPU_COMPONENT_DEBUGGER);
|
||||
core->debugger = debugger;
|
||||
}
|
||||
|
||||
|
|
|
@ -216,6 +216,10 @@ static void DSProcessEvents(struct ARMCore* cpu) {
|
|||
|
||||
void DSAttachDebugger(struct DS* ds, struct mDebugger* debugger) {
|
||||
ds->debugger = (struct ARMDebugger*) debugger->platform;
|
||||
ds->arm7->components[CPU_COMPONENT_DEBUGGER] = &debugger->d;
|
||||
ds->arm9->components[CPU_COMPONENT_DEBUGGER] = &debugger->d;
|
||||
ARMHotplugAttach(ds->arm7, CPU_COMPONENT_DEBUGGER);
|
||||
ARMHotplugAttach(ds->arm9, CPU_COMPONENT_DEBUGGER);
|
||||
}
|
||||
|
||||
void DSDetachDebugger(struct DS* ds) {
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
#include "cli.h"
|
||||
|
||||
#include "arm/debugger/cli-debugger.h"
|
||||
#include "core/core.h"
|
||||
#include "ds/core.h"
|
||||
#include "ds/ds.h"
|
||||
|
||||
#ifdef USE_CLI_DEBUGGER
|
||||
|
||||
|
@ -14,9 +17,11 @@ static bool _DSCLIDebuggerCustom(struct CLIDebuggerSystem*);
|
|||
static uint32_t _DSCLIDebuggerLookupIdentifier(struct CLIDebuggerSystem*, const char* name, struct CLIDebugVector* dv);
|
||||
|
||||
static void _frame(struct CLIDebugger*, struct CLIDebugVector*);
|
||||
static void _switchCpu(struct CLIDebugger*, struct CLIDebugVector*);
|
||||
|
||||
struct CLIDebuggerCommandSummary _DSCLIDebuggerCommands[] = {
|
||||
{ "frame", _frame, 0, "Frame advance" },
|
||||
{ "cpu", _switchCpu, 0 , "Switch active CPU" },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
|
@ -59,4 +64,20 @@ static void _frame(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
|||
struct DSCLIDebugger* dsDebugger = (struct DSCLIDebugger*) debugger->system;
|
||||
dsDebugger->frameAdvance = true;
|
||||
}
|
||||
|
||||
static void _switchCpu(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
||||
UNUSED(dv);
|
||||
struct DSCLIDebugger* dsDebugger = (struct DSCLIDebugger*) debugger->system;
|
||||
struct mCore* core = dsDebugger->core;
|
||||
struct DS* ds = core->board;
|
||||
debugger->d.platform->deinit(debugger->d.platform);
|
||||
if (core->cpu == ds->arm9) {
|
||||
core->cpu = ds->arm7;
|
||||
} else {
|
||||
core->cpu = ds->arm9;
|
||||
}
|
||||
debugger->d.platform->init(core->cpu, debugger->d.platform);
|
||||
debugger->system->printStatus(debugger->system);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue