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"
|
#include "debugger.h"
|
||||||
|
|
||||||
|
#ifdef USE_CLI_DEBUGGER
|
||||||
#include <histedit.h>
|
#include <histedit.h>
|
||||||
|
|
||||||
struct CLIDebugger;
|
struct CLIDebugger;
|
||||||
|
@ -63,5 +64,6 @@ struct CLIDebugVector* CLIDVStringParse(struct CLIDebugger* debugger, const char
|
||||||
|
|
||||||
void CLIDebuggerCreate(struct CLIDebugger*);
|
void CLIDebuggerCreate(struct CLIDebugger*);
|
||||||
void CLIDebuggerAttachSystem(struct CLIDebugger*, struct CLIDebuggerSystem*);
|
void CLIDebuggerAttachSystem(struct CLIDebugger*, struct CLIDebuggerSystem*);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include "gba-serialize.h"
|
#include "gba-serialize.h"
|
||||||
#include "gba-thread.h"
|
#include "gba-thread.h"
|
||||||
|
|
||||||
|
#ifdef USE_CLI_DEBUGGER
|
||||||
|
|
||||||
static const char* ERROR_MISSING_ARGS = "Arguments missing"; // TODO: share
|
static const char* ERROR_MISSING_ARGS = "Arguments missing"; // TODO: share
|
||||||
|
|
||||||
static void _GBACLIDebuggerInit(struct CLIDebuggerSystem*);
|
static void _GBACLIDebuggerInit(struct CLIDebuggerSystem*);
|
||||||
|
@ -23,9 +25,11 @@ struct CLIDebuggerCommandSummary _GBACLIDebuggerCommands[] = {
|
||||||
{ "save", _save, CLIDVParse, "Save a savestate" },
|
{ "save", _save, CLIDVParse, "Save a savestate" },
|
||||||
{ 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
struct GBACLIDebugger* GBACLIDebuggerCreate(struct GBAThread* context) {
|
struct GBACLIDebugger* GBACLIDebuggerCreate(struct GBAThread* context) {
|
||||||
struct GBACLIDebugger* debugger = malloc(sizeof(struct GBACLIDebugger));
|
struct GBACLIDebugger* debugger = malloc(sizeof(struct GBACLIDebugger));
|
||||||
|
#ifdef USE_CLI_DEBUGGER
|
||||||
debugger->d.init = _GBACLIDebuggerInit;
|
debugger->d.init = _GBACLIDebuggerInit;
|
||||||
debugger->d.deinit = _GBACLIDebuggerDeinit;
|
debugger->d.deinit = _GBACLIDebuggerDeinit;
|
||||||
debugger->d.lookupIdentifier = _GBACLIDebuggerLookupIdentifier;
|
debugger->d.lookupIdentifier = _GBACLIDebuggerLookupIdentifier;
|
||||||
|
@ -34,10 +38,12 @@ struct GBACLIDebugger* GBACLIDebuggerCreate(struct GBAThread* context) {
|
||||||
debugger->d.commands = _GBACLIDebuggerCommands;
|
debugger->d.commands = _GBACLIDebuggerCommands;
|
||||||
|
|
||||||
debugger->context = context;
|
debugger->context = context;
|
||||||
|
#endif
|
||||||
|
|
||||||
return debugger;
|
return debugger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_CLI_DEBUGGER
|
||||||
static void _GBACLIDebuggerInit(struct CLIDebuggerSystem* debugger) {
|
static void _GBACLIDebuggerInit(struct CLIDebuggerSystem* debugger) {
|
||||||
UNUSED(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);
|
GBASaveState(gbaDebugger->context->gba, gbaDebugger->context->stateDir, dv->intValue, true);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -11,9 +11,11 @@
|
||||||
struct GBAThread;
|
struct GBAThread;
|
||||||
|
|
||||||
struct GBACLIDebugger {
|
struct GBACLIDebugger {
|
||||||
|
#ifdef USE_CLI_DEBUGGER
|
||||||
struct CLIDebuggerSystem d;
|
struct CLIDebuggerSystem d;
|
||||||
|
|
||||||
struct GBAThread* context;
|
struct GBAThread* context;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GBACLIDebugger* GBACLIDebuggerCreate(struct GBAThread*);
|
struct GBACLIDebugger* GBACLIDebuggerCreate(struct GBAThread*);
|
||||||
|
|
Loading…
Reference in New Issue