mirror of https://github.com/mgba-emu/mgba.git
Debugger: Properly isolate CLI debugger code
This commit is contained in:
parent
fb4ea22d71
commit
a4a7ef4a1b
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "debugger.h"
|
||||
|
||||
#ifdef USE_CLI_DEBUGGER
|
||||
#include <histedit.h>
|
||||
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -11,9 +11,11 @@
|
|||
struct GBAThread;
|
||||
|
||||
struct GBACLIDebugger {
|
||||
#ifdef USE_CLI_DEBUGGER
|
||||
struct CLIDebuggerSystem d;
|
||||
|
||||
struct GBAThread* context;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct GBACLIDebugger* GBACLIDebuggerCreate(struct GBAThread*);
|
||||
|
|
Loading…
Reference in New Issue