all repos — mgba @ a4a7ef4a1bf7a9b7dae78bf835fe3a3f312c9786

mGBA Game Boy Advance Emulator

Debugger: Properly isolate CLI debugger code
Jeffrey Pfau jeffrey@endrift.com
Mon, 08 Dec 2014 15:59:17 -0800
commit

a4a7ef4a1bf7a9b7dae78bf835fe3a3f312c9786

parent

fb4ea22d713203c1010f9bf88d4010b91771892c

3 files changed, 11 insertions(+), 1 deletions(-)

jump to
M src/debugger/cli-debugger.hsrc/debugger/cli-debugger.h

@@ -10,6 +10,7 @@ #include "util/common.h"

#include "debugger.h" +#ifdef USE_CLI_DEBUGGER #include <histedit.h> struct CLIDebugger;

@@ -63,5 +64,6 @@ struct CLIDebugVector* CLIDVStringParse(struct CLIDebugger* debugger, const char* string, size_t length);

void CLIDebuggerCreate(struct CLIDebugger*); void CLIDebuggerAttachSystem(struct CLIDebugger*, struct CLIDebuggerSystem*); +#endif #endif
M src/gba/gba-cli.csrc/gba/gba-cli.c

@@ -9,6 +9,8 @@ #include "gba-io.h"

#include "gba-serialize.h" #include "gba-thread.h" +#ifdef USE_CLI_DEBUGGER + static const char* ERROR_MISSING_ARGS = "Arguments missing"; // TODO: share static void _GBACLIDebuggerInit(struct CLIDebuggerSystem*);

@@ -23,9 +25,11 @@ { "load", _load, CLIDVParse, "Load a savestate" },

{ "save", _save, CLIDVParse, "Save a savestate" }, { 0, 0, 0, 0 } }; +#endif struct GBACLIDebugger* GBACLIDebuggerCreate(struct GBAThread* context) { struct GBACLIDebugger* debugger = malloc(sizeof(struct GBACLIDebugger)); +#ifdef USE_CLI_DEBUGGER debugger->d.init = _GBACLIDebuggerInit; debugger->d.deinit = _GBACLIDebuggerDeinit; debugger->d.lookupIdentifier = _GBACLIDebuggerLookupIdentifier;

@@ -34,10 +38,12 @@ debugger->d.name = "Game Boy Advance";

debugger->d.commands = _GBACLIDebuggerCommands; debugger->context = context; +#endif return debugger; } +#ifdef USE_CLI_DEBUGGER static void _GBACLIDebuggerInit(struct CLIDebuggerSystem* debugger) { UNUSED(debugger); }

@@ -90,4 +96,4 @@ struct GBACLIDebugger* gbaDebugger = (struct GBACLIDebugger*) debugger->system;

GBASaveState(gbaDebugger->context->gba, gbaDebugger->context->stateDir, dv->intValue, true); } - +#endif
M src/gba/gba-cli.hsrc/gba/gba-cli.h

@@ -11,9 +11,11 @@

struct GBAThread; struct GBACLIDebugger { +#ifdef USE_CLI_DEBUGGER struct CLIDebuggerSystem d; struct GBAThread* context; +#endif }; struct GBACLIDebugger* GBACLIDebuggerCreate(struct GBAThread*);