diff --git a/src/gba/gba-cli.c b/src/gba/gba-cli.c new file mode 100644 index 000000000..1796713d2 --- /dev/null +++ b/src/gba/gba-cli.c @@ -0,0 +1,41 @@ +#include "gba-cli.h" + +#include "gba-thread.h" + +static void _GBACLIDebuggerInit(struct CLIDebuggerSystem*); +static void _GBACLIDebuggerDeinit(struct CLIDebuggerSystem*); +static uint32_t _GBACLIDebuggerLookupIdentifier(struct CLIDebuggerSystem*, const char* name, struct CLIDebugVector* dv); + +struct CLIDebuggerCommandSummary _GBACLIDebuggerCommands[] = { + { 0, 0, 0, 0 } +}; + +struct GBACLIDebugger* GBACLIDebuggerCreate(struct GBAThread* context) { + struct GBACLIDebugger* debugger = malloc(sizeof(struct GBACLIDebugger)); + debugger->d.init = _GBACLIDebuggerInit; + debugger->d.deinit = _GBACLIDebuggerDeinit; + debugger->d.lookupIdentifier = _GBACLIDebuggerLookupIdentifier; + + debugger->d.name = "Game Boy Advance"; + debugger->d.commands = _GBACLIDebuggerCommands; + + debugger->context = context; + + return debugger; +} + +static void _GBACLIDebuggerInit(struct CLIDebuggerSystem* debugger) { + UNUSED(debugger); +} + +static void _GBACLIDebuggerDeinit(struct CLIDebuggerSystem* debugger) { + UNUSED(debugger); +} + +static uint32_t _GBACLIDebuggerLookupIdentifier(struct CLIDebuggerSystem* debugger, const char* name, struct CLIDebugVector* dv) { + UNUSED(debugger); + UNUSED(name); + dv->type = CLIDV_ERROR_TYPE; + return 0; +} + diff --git a/src/gba/gba-cli.h b/src/gba/gba-cli.h new file mode 100644 index 000000000..0fb701e72 --- /dev/null +++ b/src/gba/gba-cli.h @@ -0,0 +1,16 @@ +#ifndef GBA_CLI_H +#define GBA_CLI_H + +#include "debugger/cli-debugger.h" + +struct GBAThread; + +struct GBACLIDebugger { + struct CLIDebuggerSystem d; + + struct GBAThread* context; +}; + +struct GBACLIDebugger* GBACLIDebuggerCreate(struct GBAThread*); + +#endif diff --git a/src/platform/commandline.c b/src/platform/commandline.c index 4df33a9cb..a7fa2eb0e 100644 --- a/src/platform/commandline.c +++ b/src/platform/commandline.c @@ -4,6 +4,7 @@ #ifdef USE_CLI_DEBUGGER #include "debugger/cli-debugger.h" +#include "gba/gba-cli.h" #endif #ifdef USE_GDB_STUB @@ -146,7 +147,9 @@ bool _parseGraphicsArg(struct SubParser* parser, struct GBAConfig* config, int o } struct ARMDebugger* createDebugger(struct GBAArguments* opts, struct GBAThread* context) { +#ifndef USE_CLI_DEBUGGER UNUSED(context); +#endif union DebugUnion { struct ARMDebugger d; #ifdef USE_CLI_DEBUGGER @@ -163,6 +166,8 @@ struct ARMDebugger* createDebugger(struct GBAArguments* opts, struct GBAThread* #ifdef USE_CLI_DEBUGGER case DEBUGGER_CLI: CLIDebuggerCreate(&debugger->cli); + struct GBACLIDebugger* gbaDebugger = GBACLIDebuggerCreate(context); + CLIDebuggerAttachSystem(&debugger->cli, &gbaDebugger->d); break; #endif #ifdef USE_GDB_STUB