GBA: Add skeleton of GBA-specific CLI debugger

This commit is contained in:
Jeffrey Pfau 2014-11-27 10:11:10 -08:00
parent a8731d280f
commit 4a9b87cfd0
3 changed files with 62 additions and 0 deletions

41
src/gba/gba-cli.c Normal file
View File

@ -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;
}

16
src/gba/gba-cli.h Normal file
View File

@ -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

View File

@ -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