From a4a7ef4a1bf7a9b7dae78bf835fe3a3f312c9786 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Mon, 8 Dec 2014 15:59:17 -0800 Subject: [PATCH] Debugger: Properly isolate CLI debugger code --- src/debugger/cli-debugger.h | 2 ++ src/gba/gba-cli.c | 8 +++++++- src/gba/gba-cli.h | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/debugger/cli-debugger.h b/src/debugger/cli-debugger.h index 9ba693403..1590caa9d 100644 --- a/src/debugger/cli-debugger.h +++ b/src/debugger/cli-debugger.h @@ -10,6 +10,7 @@ #include "debugger.h" +#ifdef USE_CLI_DEBUGGER #include struct CLIDebugger; @@ -63,5 +64,6 @@ struct CLIDebugVector* CLIDVStringParse(struct CLIDebugger* debugger, const char void CLIDebuggerCreate(struct CLIDebugger*); void CLIDebuggerAttachSystem(struct CLIDebugger*, struct CLIDebuggerSystem*); +#endif #endif diff --git a/src/gba/gba-cli.c b/src/gba/gba-cli.c index 47e24625b..55f1a9816 100644 --- a/src/gba/gba-cli.c +++ b/src/gba/gba-cli.c @@ -9,6 +9,8 @@ #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 @@ struct CLIDebuggerCommandSummary _GBACLIDebuggerCommands[] = { { "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 @@ struct GBACLIDebugger* GBACLIDebuggerCreate(struct GBAThread* context) { 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 @@ static void _save(struct CLIDebugger* debugger, struct CLIDebugVector* dv) { GBASaveState(gbaDebugger->context->gba, gbaDebugger->context->stateDir, dv->intValue, true); } - +#endif diff --git a/src/gba/gba-cli.h b/src/gba/gba-cli.h index 5c0546992..9364019db 100644 --- a/src/gba/gba-cli.h +++ b/src/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*);