GBA: Add skeleton of GBA-specific CLI debugger
Jeffrey Pfau jeffrey@endrift.com
Thu, 27 Nov 2014 10:11:10 -0800
3 files changed,
62 insertions(+),
0 deletions(-)
A
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; +} +
A
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
M
src/platform/commandline.c
→
src/platform/commandline.c
@@ -4,6 +4,7 @@ #include "debugger/debugger.h"
#ifdef USE_CLI_DEBUGGER #include "debugger/cli-debugger.h" +#include "gba/gba-cli.h" #endif #ifdef USE_GDB_STUB@@ -146,7 +147,9 @@ }
} 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 @@ switch (opts->debuggerType) {
#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