all repos — mgba @ eccddde2834544da2ce62dfb3abe2c596207bd5f

mGBA Game Boy Advance Emulator

Debugger: Update createDebugger
Jeffrey Pfau jeffrey@endrift.com
Sun, 07 Feb 2016 14:28:35 -0800
commit

eccddde2834544da2ce62dfb3abe2c596207bd5f

parent

e4aed77f1e9405c64afefaaff4f929388c7c7e54

M src/gba/supervisor/cli.csrc/gba/supervisor/cli.c

@@ -31,7 +31,7 @@ { "save", _save, CLIDVParse, "Save a savestate" },

{ 0, 0, 0, 0 } }; -struct GBACLIDebugger* GBACLIDebuggerCreate(struct GBAThread* context) { +struct GBACLIDebugger* GBACLIDebuggerCreate(struct mCore* core) { struct GBACLIDebugger* debugger = malloc(sizeof(struct GBACLIDebugger)); debugger->d.init = _GBACLIDebuggerInit; debugger->d.deinit = _GBACLIDebuggerDeinit;

@@ -41,7 +41,7 @@

debugger->d.name = "Game Boy Advance"; debugger->d.commands = _GBACLIDebuggerCommands; - debugger->context = context; + debugger->core = core; return debugger; }

@@ -60,12 +60,12 @@ static bool _GBACLIDebuggerCustom(struct CLIDebuggerSystem* debugger) {

struct GBACLIDebugger* gbaDebugger = (struct GBACLIDebugger*) debugger; if (gbaDebugger->frameAdvance) { - if (!gbaDebugger->inVblank && GBARegisterDISPSTATIsInVblank(gbaDebugger->context->gba->memory.io[REG_DISPSTAT >> 1])) { + if (!gbaDebugger->inVblank && GBARegisterDISPSTATIsInVblank(((struct GBA*) gbaDebugger->core->board)->memory.io[REG_DISPSTAT >> 1])) { ARMDebuggerEnter(&gbaDebugger->d.p->d, DEBUGGER_ENTER_MANUAL, 0); gbaDebugger->frameAdvance = false; return false; } - gbaDebugger->inVblank = GBARegisterDISPSTATGetInVblank(gbaDebugger->context->gba->memory.io[REG_DISPSTAT >> 1]); + gbaDebugger->inVblank = GBARegisterDISPSTATGetInVblank(((struct GBA*) gbaDebugger->core->board)->memory.io[REG_DISPSTAT >> 1]); return true; } return false;

@@ -90,7 +90,7 @@ debugger->d.state = DEBUGGER_CUSTOM;

struct GBACLIDebugger* gbaDebugger = (struct GBACLIDebugger*) debugger->system; gbaDebugger->frameAdvance = true; - gbaDebugger->inVblank = GBARegisterDISPSTATGetInVblank(gbaDebugger->context->gba->memory.io[REG_DISPSTAT >> 1]); + gbaDebugger->inVblank = GBARegisterDISPSTATGetInVblank(((struct GBA*) gbaDebugger->core->board)->memory.io[REG_DISPSTAT >> 1]); } static void _load(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {

@@ -106,17 +106,17 @@ }

struct GBACLIDebugger* gbaDebugger = (struct GBACLIDebugger*) debugger->system; - GBALoadState(gbaDebugger->context, gbaDebugger->context->dirs.state, dv->intValue, SAVESTATE_SCREENSHOT); + mCoreLoadState(gbaDebugger->core, dv->intValue, SAVESTATE_SCREENSHOT); } static void _rewind(struct CLIDebugger* debugger, struct CLIDebugVector* dv) { struct GBACLIDebugger* gbaDebugger = (struct GBACLIDebugger*) debugger->system; if (!dv) { - GBARewindAll(gbaDebugger->context); + // TODO: Put back rewind } else if (dv->type != CLIDV_INT_TYPE) { printf("%s\n", ERROR_MISSING_ARGS); } else { - GBARewind(gbaDebugger->context, dv->intValue); + // TODO: Put back rewind } }

@@ -133,6 +133,6 @@ }

struct GBACLIDebugger* gbaDebugger = (struct GBACLIDebugger*) debugger->system; - GBASaveState(gbaDebugger->context, gbaDebugger->context->dirs.state, dv->intValue, SAVESTATE_SCREENSHOT); + mCoreSaveState(gbaDebugger->core, dv->intValue, SAVESTATE_SCREENSHOT); } #endif
M src/gba/supervisor/cli.hsrc/gba/supervisor/cli.h

@@ -9,18 +9,18 @@

#ifdef USE_CLI_DEBUGGER #include "debugger/cli-debugger.h" -struct GBAThread; +struct mCore; struct GBACLIDebugger { struct CLIDebuggerSystem d; - struct GBAThread* context; + struct mCore* core; bool frameAdvance; bool inVblank; }; -struct GBACLIDebugger* GBACLIDebuggerCreate(struct GBAThread*); +struct GBACLIDebugger* GBACLIDebuggerCreate(struct mCore*); #endif #endif
M src/platform/commandline.csrc/platform/commandline.c

@@ -199,7 +199,7 @@ struct mGraphicsOpts* graphicsOpts = parser->opts;

mCoreConfigSetOverrideIntValue(config, "fullscreen", graphicsOpts->fullscreen); } -struct ARMDebugger* createDebugger(struct mArguments* opts, struct GBAThread* context) { +struct ARMDebugger* createDebugger(struct mArguments* opts, struct mCore* core) { #ifndef USE_CLI_DEBUGGER UNUSED(context); #endif

@@ -219,7 +219,7 @@ switch (opts->debuggerType) {

#ifdef USE_CLI_DEBUGGER case DEBUGGER_CLI: CLIDebuggerCreate(&debugger->cli); - struct GBACLIDebugger* gbaDebugger = GBACLIDebuggerCreate(context); + struct GBACLIDebugger* gbaDebugger = GBACLIDebuggerCreate(core); CLIDebuggerAttachSystem(&debugger->cli, &gbaDebugger->d); break; #endif
M src/platform/commandline.hsrc/platform/commandline.h

@@ -59,6 +59,7 @@ void usage(const char* arg0, const char* extraOptions);

void version(const char* arg0); void initParserForGraphics(struct mSubParser* parser, struct mGraphicsOpts* opts); -struct ARMDebugger* createDebugger(struct mArguments* opts, struct GBAThread* context); +struct mCore; +struct ARMDebugger* createDebugger(struct mArguments* opts, struct mCore* core); #endif