CMake: Rename USE_DEBUGGERS and USE_GDB_STUB to ENABLE_DEBUGGERS and ENABLE_GDB_STUB

ENABLE flags are for optional features, USE flags are for optional dependencies
This commit is contained in:
Vicki Pfau 2024-04-08 03:08:10 -07:00
parent 4652bbb427
commit 0e441527c8
33 changed files with 110 additions and 110 deletions

View File

@ -46,11 +46,11 @@ else()
endif()
if(NOT LIBMGBA_ONLY)
set(USE_DEBUGGERS ON CACHE BOOL "Whether or not to enable the debugging infrastructure")
set(ENABLE_DEBUGGERS ON CACHE BOOL "Whether or not to enable the debugging infrastructure")
if (NOT WIN32)
set(USE_EDITLINE ON CACHE BOOL "Whether or not to enable the CLI-mode debugger")
endif()
set(USE_GDB_STUB ON CACHE BOOL "Whether or not to enable the GDB stub ARM debugger")
set(ENABLE_GDB_STUB ON CACHE BOOL "Whether or not to enable the GDB stub ARM debugger")
set(USE_FFMPEG ON CACHE BOOL "Whether or not to enable FFmpeg support")
set(USE_ZLIB ON CACHE BOOL "Whether or not to enable zlib support")
set(USE_MINIZIP ON CACHE BOOL "Whether or not to enable external minizip support")
@ -301,7 +301,7 @@ endif()
if(DEFINED 3DS OR DEFINED PSP2 OR DEFINED WII OR DEFINED SWITCH)
set(IS_EMBEDDED ON)
set(USE_DEBUGGERS OFF)
set(ENABLE_DEBUGGERS OFF)
set(USE_SQLITE3 OFF)
set(USE_DISCORD_RPC OFF)
set(USE_LIBZIP OFF CACHE BOOL "")
@ -313,12 +313,12 @@ if(DEFINED SWITCH)
endif()
if(NOT M_CORE_GBA)
set(USE_GDB_STUB OFF)
set(ENABLE_GDB_STUB OFF)
endif()
if(NOT USE_DEBUGGERS)
if(NOT ENABLE_DEBUGGERS)
set(USE_EDITLINE OFF)
set(USE_GDB_STUB OFF)
set(ENABLE_GDB_STUB OFF)
endif()
if(WII)
@ -489,7 +489,7 @@ if(NOT BUILD_GLES2 AND NOT BUILD_GLES3 AND NOT LIBMGBA_ONLY)
endif()
if(DISABLE_DEPS)
set(USE_GDB_STUB OFF)
set(ENABLE_GDB_STUB OFF)
set(USE_DISCORD_RPC OFF)
set(USE_JSON_C OFF)
set(USE_SQLITE3 OFF)
@ -541,8 +541,8 @@ else()
set(DEBUGGER_LIB "")
endif()
if(USE_GDB_STUB)
list(APPEND FEATURES GDB_STUB)
if(ENABLE_GDB_STUB)
list(APPEND ENABLES GDB_STUB)
endif()
source_group("Debugger" FILES ${DEBUGGER_SRC})
@ -851,10 +851,10 @@ if(M_CORE_GBA)
list(APPEND TEST_SRC ${ARM_TEST_SRC} ${GBA_TEST_SRC})
endif()
if(USE_DEBUGGERS)
if(ENABLE_DEBUGGERS)
list(APPEND FEATURE_SRC ${DEBUGGER_SRC})
list(APPEND TEST_SRC ${DEBUGGER_TEST_SRC})
list(APPEND FEATURES DEBUGGERS)
list(APPEND ENABLES DEBUGGERS)
endif()
if(ENABLE_SCRIPTING)
@ -1312,11 +1312,11 @@ if(NOT QUIET AND NOT LIBMGBA_ONLY)
message(STATUS " Game Boy Advance: ${M_CORE_GBA}")
message(STATUS " Game Boy: ${M_CORE_GB}")
message(STATUS "Features:")
message(STATUS " Debuggers: ${USE_DEBUGGERS}")
message(STATUS " Debuggers: ${ENABLE_DEBUGGERS}")
if(NOT WIN32)
message(STATUS " CLI debugger: ${USE_EDITLINE}")
endif()
message(STATUS " GDB stub: ${USE_GDB_STUB}")
message(STATUS " GDB stub: ${ENABLE_GDB_STUB}")
message(STATUS " GIF/Video recording: ${USE_FFMPEG}")
message(STATUS " Screenshot/advanced savestate support: ${USE_PNG}")
message(STATUS " ZIP support: ${SUMMARY_ZIP}")

View File

@ -18,7 +18,7 @@ CXX_GUARD_START
#include <mgba/core/input.h>
#endif
#include <mgba/core/interface.h>
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
#include <mgba/debugger/debugger.h>
#endif
@ -146,7 +146,7 @@ struct mCore {
bool (*readRegister)(const struct mCore*, const char* name, void* out);
bool (*writeRegister)(struct mCore*, const char* name, const void* in);
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
bool (*supportsDebuggerType)(struct mCore*, enum mDebuggerType);
struct mDebuggerPlatform* (*debuggerPlatform)(struct mCore*);
struct CLIDebuggerSystem* (*cliDebuggerSystem)(struct mCore*);
@ -219,7 +219,7 @@ const struct mCoreMemoryBlock* mCoreGetMemoryBlockInfo(struct mCore* core, uint3
#ifdef USE_ELF
struct ELF;
bool mCoreLoadELF(struct mCore* core, struct ELF* elf);
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
void mCoreLoadELFSymbols(struct mDebuggerSymbols* symbols, struct ELF*);
#endif
#endif

View File

@ -10,7 +10,7 @@
CXX_GUARD_START
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
#include <mgba/debugger/debugger.h>
#endif
#include <mgba/script/macros.h>
@ -35,7 +35,7 @@ struct mScriptEngine {
void (*run)(struct mScriptEngine*);
bool (*lookupSymbol)(struct mScriptEngine*, const char* name, int32_t* out);
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
void (*debuggerEntered)(struct mScriptEngine*, enum mDebuggerEntryReason, struct mDebuggerEntryInfo*);
#endif
};
@ -63,7 +63,7 @@ void mScriptBridgeDestroy(struct mScriptBridge*);
void mScriptBridgeInstallEngine(struct mScriptBridge*, struct mScriptEngine*);
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
void mScriptBridgeSetDebugger(struct mScriptBridge*, struct mDebugger*);
struct mDebugger* mScriptBridgeGetDebugger(struct mScriptBridge*);
void mScriptBridgeDebuggerEntered(struct mScriptBridge*, enum mDebuggerEntryReason, struct mDebuggerEntryInfo*);

View File

@ -221,7 +221,7 @@ bool ARMDecodeThumbCombine(struct ARMInstructionInfo* info1, struct ARMInstructi
struct ARMInstructionInfo* out);
uint32_t ARMResolveMemoryAccess(struct ARMInstructionInfo* info, struct ARMRegisterFile* regs, uint32_t pc);
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
struct mDebuggerSymbols;
int ARMDisassemble(const struct ARMInstructionInfo* info, struct ARMCore* core, const struct mDebuggerSymbols* symbols, uint32_t pc, char* buffer, int blen);
#endif

View File

@ -160,7 +160,7 @@ struct ELF;
bool GBAVerifyELFEntry(struct ELF* elf, uint32_t target);
#endif
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
struct mDebugger;
void GBAAttachDebugger(struct GBA* gba, struct mDebugger* debugger);
void GBADetachDebugger(struct GBA* gba);

View File

@ -9,7 +9,7 @@
#include <mgba/internal/debugger/symbols.h>
#include <mgba-util/string.h>
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
#define ADVANCE(AMOUNT) \
if (AMOUNT >= blen) { \
buffer[blen - 1] = '\0'; \

View File

@ -467,7 +467,7 @@ bool mCoreLoadELF(struct mCore* core, struct ELF* elf) {
return true;
}
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
void mCoreLoadELFSymbols(struct mDebuggerSymbols* symbols, struct ELF* elf) {
size_t symIndex = ELFFindSection(elf, ".symtab");
size_t names = ELFFindSection(elf, ".strtab");

View File

@ -49,16 +49,20 @@
// ENABLE flags
#ifndef ENABLE_DEBUGGERS
#cmakedefine ENABLE_DEBUGGERS
#endif
#ifndef ENABLE_GDB_STUB
#cmakedefine ENABLE_GDB_STUB
#endif
#ifndef ENABLE_SCRIPTING
#cmakedefine ENABLE_SCRIPTING
#endif
// USE flags
#ifndef USE_DEBUGGERS
#cmakedefine USE_DEBUGGERS
#endif
#ifndef USE_DISCORD_RPC
#cmakedefine USE_DISCORD_RPC
#endif
@ -79,10 +83,6 @@
#cmakedefine USE_FFMPEG
#endif
#ifndef USE_GDB_STUB
#cmakedefine USE_GDB_STUB
#endif
#ifndef USE_JSON_C
#cmakedefine USE_JSON_C
#endif

View File

@ -64,7 +64,7 @@ static void _seRun(const char* key, void* value, void* user) {
se->run(se);
}
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
struct mScriptDebuggerEntry {
enum mDebuggerEntryReason reason;
struct mDebuggerEntryInfo* info;
@ -98,7 +98,7 @@ void mScriptBridgeInstallEngine(struct mScriptBridge* sb, struct mScriptEngine*
HashTableInsert(&sb->engines, name, se);
}
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
void mScriptBridgeSetDebugger(struct mScriptBridge* sb, struct mDebugger* debugger) {
if (sb->debugger == debugger) {
return;
@ -159,7 +159,7 @@ struct mScriptMemoryDomain {
struct mCoreMemoryBlock block;
};
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
struct mScriptBreakpointName {
uint32_t address;
uint32_t maxAddress;
@ -189,7 +189,7 @@ struct mScriptCoreAdapter {
struct mCore* core;
struct mScriptContext* context;
struct mScriptValue memory;
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
struct mScriptDebugger debugger;
#endif
struct mRumble rumble;
@ -701,7 +701,7 @@ static void _rebuildMemoryMap(struct mScriptContext* context, struct mScriptCore
}
}
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
static void _freeBreakpoint(void* bp) {
struct mScriptBreakpoint* point = bp;
HashTableDeinit(&point->callbacks);
@ -929,7 +929,7 @@ static bool _mScriptCoreAdapterClearBreakpoint(struct mScriptCoreAdapter* adapte
static void _mScriptCoreAdapterDeinit(struct mScriptCoreAdapter* adapter) {
_clearMemoryMap(adapter->context, adapter, false);
adapter->memory.type->free(&adapter->memory);
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
if (adapter->core->debugger) {
mDebuggerDetachModule(adapter->core->debugger, &adapter->debugger.d);
}
@ -982,7 +982,7 @@ mSCRIPT_DECLARE_STRUCT_VOID_METHOD(mScriptCoreAdapter, _deinit, _mScriptCoreAdap
mSCRIPT_DECLARE_STRUCT_VOID_METHOD(mScriptCoreAdapter, reset, _mScriptCoreAdapterReset, 0);
mSCRIPT_DECLARE_STRUCT_METHOD(mScriptCoreAdapter, WTABLE, setRotationCallbacks, _mScriptCoreAdapterSetRotationCbTable, 1, WTABLE, cbTable);
mSCRIPT_DECLARE_STRUCT_VOID_METHOD(mScriptCoreAdapter, setSolarSensorCallback, _mScriptCoreAdapterSetLuminanceCb, 1, WRAPPER, callback);
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
mSCRIPT_DECLARE_STRUCT_METHOD_WITH_DEFAULTS(mScriptCoreAdapter, S64, setBreakpoint, _mScriptCoreAdapterSetBreakpoint, 3, WRAPPER, callback, U32, address, S32, segment);
mSCRIPT_DECLARE_STRUCT_METHOD_WITH_DEFAULTS(mScriptCoreAdapter, S64, setWatchpoint, _mScriptCoreAdapterSetWatchpoint, 4, WRAPPER, callback, U32, address, S32, type, S32, segment);
mSCRIPT_DECLARE_STRUCT_METHOD_WITH_DEFAULTS(mScriptCoreAdapter, S64, setRangeWatchpoint, _mScriptCoreAdapterSetRangeWatchpoint, 5, WRAPPER, callback, U32, minAddress, U32, maxAddress, S32, type, S32, segment);
@ -1040,7 +1040,7 @@ mSCRIPT_DEFINE_STRUCT(mScriptCoreAdapter)
"Note that the full range of values is not used by games, and the exact range depends on the calibration done by the game itself."
)
mSCRIPT_DEFINE_STRUCT_METHOD(mScriptCoreAdapter, setSolarSensorCallback)
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
mSCRIPT_DEFINE_DOCSTRING("Set a breakpoint at a given address")
mSCRIPT_DEFINE_STRUCT_METHOD(mScriptCoreAdapter, setBreakpoint)
mSCRIPT_DEFINE_DOCSTRING("Clear a breakpoint or watchpoint for a given id returned by a previous call")

View File

@ -327,7 +327,7 @@ M_TEST_DEFINE(screenshot) {
TEARDOWN_CORE;
}
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
void _setupBp(struct mCore* core) {
switch (core->platform(core)) {
#ifdef M_CORE_GBA
@ -727,7 +727,7 @@ M_TEST_SUITE_DEFINE_SETUP_TEARDOWN(mScriptCore,
cmocka_unit_test(memoryWrite),
cmocka_unit_test(logging),
cmocka_unit_test(screenshot),
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
#ifdef M_CORE_GBA
cmocka_unit_test(basicBreakpointGBA),
#endif

View File

@ -103,7 +103,7 @@ static void _wait(struct mCoreThreadInternal* threadContext) {
MutexUnlock(&threadContext->sync.audioBufferMutex);
}
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
if (threadContext->core && threadContext->core->debugger) {
mDebuggerInterrupt(threadContext->core->debugger);
}
@ -330,7 +330,7 @@ static THREAD_ENTRY _mCoreThreadRun(void* context) {
MutexLock(&impl->stateMutex);
while (impl->state < mTHREAD_EXITING) {
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
struct mDebugger* debugger = core->debugger;
if (debugger) {
MutexUnlock(&impl->stateMutex);
@ -355,7 +355,7 @@ static THREAD_ENTRY _mCoreThreadRun(void* context) {
}
while (impl->state >= mTHREAD_MIN_WAITING && impl->state <= mTHREAD_MAX_WAITING) {
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
if (debugger && debugger->state != DEBUGGER_SHUTDOWN) {
mDebuggerUpdate(debugger);
ConditionWaitTimed(&impl->stateOnThreadCond, &impl->stateMutex, 10);

View File

@ -15,7 +15,7 @@ if(USE_EDITLINE)
list(APPEND SOURCE_FILES cli-el-backend.c)
endif()
if(USE_GDB_STUB)
if(ENABLE_GDB_STUB)
list(APPEND SOURCE_FILES gdb-stub.c)
endif()

View File

@ -1420,7 +1420,7 @@ static void _loadSymbols(struct CLIDebugger* debugger, struct CLIDebugVector* dv
#ifdef USE_ELF
struct ELF* elf = ELFOpen(vf);
if (elf) {
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
mCoreLoadELFSymbols(symbolTable, elf);
#endif
ELFClose(elf);

View File

@ -10,7 +10,7 @@
#include <mgba/internal/debugger/cli-debugger.h>
#include <mgba/internal/debugger/symbols.h>
#ifdef USE_GDB_STUB
#ifdef ENABLE_GDB_STUB
#include <mgba/internal/debugger/gdb-stub.h>
#endif
@ -37,7 +37,7 @@ struct mDebuggerModule* mDebuggerCreateModule(enum mDebuggerType type, struct mC
union DebugUnion {
struct mDebuggerModule d;
struct CLIDebugger cli;
#ifdef USE_GDB_STUB
#ifdef ENABLE_GDB_STUB
struct GDBStub gdb;
#endif
};
@ -52,7 +52,7 @@ struct mDebuggerModule* mDebuggerCreateModule(enum mDebuggerType type, struct mC
CLIDebuggerAttachSystem(&debugger->cli, sys);
break;
case DEBUGGER_GDB:
#ifdef USE_GDB_STUB
#ifdef ENABLE_GDB_STUB
GDBStubCreate(&debugger->gdb);
struct Address localHost = {
.version = IPV4,

View File

@ -12,7 +12,7 @@
#include <mgba-util/string.h>
#include <mgba-util/vfs.h>
#ifdef USE_GDB_STUB
#ifdef ENABLE_GDB_STUB
#include <mgba/internal/debugger/gdb-stub.h>
#endif
#ifdef USE_EDITLINE
@ -40,7 +40,7 @@ static const struct option _options[] = {
#ifdef USE_EDITLINE
{ "debug", no_argument, 0, 'd' },
#endif
#ifdef USE_GDB_STUB
#ifdef ENABLE_GDB_STUB
{ "gdb", no_argument, 0, 'g' },
#endif
{ "help", no_argument, 0, 'h' },
@ -85,7 +85,7 @@ bool mArgumentsParse(struct mArguments* args, int argc, char* const* argv, struc
#ifdef USE_EDITLINE
"d"
#endif
#ifdef USE_GDB_STUB
#ifdef ENABLE_GDB_STUB
"g"
#endif
;
@ -151,7 +151,7 @@ bool mArgumentsParse(struct mArguments* args, int argc, char* const* argv, struc
args->debugCli = true;
break;
#endif
#ifdef USE_GDB_STUB
#ifdef ENABLE_GDB_STUB
case 'g':
args->debugAtStart = true;
args->debugGdb = true;
@ -231,7 +231,7 @@ bool mArgumentsApplyDebugger(const struct mArguments* args, struct mCore* core,
}
#endif
#ifdef USE_GDB_STUB
#ifdef ENABLE_GDB_STUB
if (args->debugGdb) {
struct mDebuggerModule* module = mDebuggerCreateModule(DEBUGGER_GDB, core);
if (module) {
@ -355,7 +355,7 @@ void usage(const char* arg0, const char* prologue, const char* epilogue, const s
#ifdef USE_EDITLINE
" -d, --debug Use command-line debugger\n"
#endif
#ifdef USE_GDB_STUB
#ifdef ENABLE_GDB_STUB
" -g, --gdb Start GDB session (default port 2345)\n"
#endif
" -l, --log-level N Log level mask\n"

View File

@ -164,7 +164,7 @@ static void _GBCoreDeinit(struct mCore* core) {
#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
mDirectorySetDeinit(&core->dirs);
#endif
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
if (core->symbolTable) {
mDebuggerSymbolTableDestroy(core->symbolTable);
}
@ -1060,7 +1060,7 @@ static bool _GBCoreWriteRegister(struct mCore* core, const char* name, const voi
return false;
}
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
static bool _GBCoreSupportsDebuggerType(struct mCore* core, enum mDebuggerType type) {
UNUSED(core);
switch (type) {
@ -1352,7 +1352,7 @@ struct mCore* GBCoreCreate(void) {
core->listRegisters = _GBCoreListRegisters;
core->readRegister = _GBCoreReadRegister;
core->writeRegister = _GBCoreWriteRegister;
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
core->supportsDebuggerType = _GBCoreSupportsDebuggerType;
core->debuggerPlatform = _GBCoreDebuggerPlatform;
core->cliDebuggerSystem = _GBCoreCliDebuggerSystem;

View File

@ -940,7 +940,7 @@ void GBProcessEvents(struct SM83Core* cpu) {
nextEvent = cycles;
do {
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
gb->timing.globalCycles += nextEvent;
#endif
nextEvent = mTimingTick(&gb->timing, nextEvent);
@ -1057,7 +1057,7 @@ void GBStop(struct SM83Core* cpu) {
void GBIllegal(struct SM83Core* cpu) {
struct GB* gb = (struct GB*) cpu->master;
mLOG(GB, GAME_ERROR, "Hit illegal opcode at address %04X:%02X", cpu->pc, cpu->bus);
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
if (cpu->components && cpu->components[CPU_COMPONENT_DEBUGGER]) {
struct mDebuggerEntryInfo info = {
.address = cpu->pc,

View File

@ -313,7 +313,7 @@ static void _GBACoreDeinit(struct mCore* core) {
#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
mDirectorySetDeinit(&core->dirs);
#endif
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
if (core->symbolTable) {
mDebuggerSymbolTableDestroy(core->symbolTable);
}
@ -1218,7 +1218,7 @@ static bool _GBACoreWriteRegister(struct mCore* core, const char* name, const vo
return true;
}
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
static bool _GBACoreSupportsDebuggerType(struct mCore* core, enum mDebuggerType type) {
UNUSED(core);
switch (type) {
@ -1280,7 +1280,7 @@ static void _GBACoreLoadSymbols(struct mCore* core, struct VFile* vf) {
#ifdef USE_ELF
struct ELF* elf = ELFOpen(vf);
if (elf) {
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
mCoreLoadELFSymbols(core->symbolTable, elf);
#endif
ELFClose(elf);
@ -1565,7 +1565,7 @@ struct mCore* GBACoreCreate(void) {
core->listRegisters = _GBACoreListRegisters;
core->readRegister = _GBACoreReadRegister;
core->writeRegister = _GBACoreWriteRegister;
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
core->supportsDebuggerType = _GBACoreSupportsDebuggerType;
core->debuggerPlatform = _GBACoreDebuggerPlatform;
core->cliDebuggerSystem = _GBACoreCliDebuggerSystem;

View File

@ -49,7 +49,7 @@ static void GBATestIRQNoDelay(struct ARMCore* cpu);
static void _triggerIRQ(struct mTiming*, void* user, uint32_t cyclesLate);
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
static bool _setSoftwareBreakpoint(struct ARMDebugger*, uint32_t address, enum ExecutionMode mode, uint32_t* opcode);
static void _clearSoftwareBreakpoint(struct ARMDebugger*, const struct ARMDebugBreakpoint*);
#endif
@ -305,7 +305,7 @@ static void GBAProcessEvents(struct ARMCore* cpu) {
do {
int32_t cycles = cpu->cycles;
cpu->cycles = 0;
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
gba->timing.globalCycles += cycles < nextEvent ? nextEvent : cycles;
#endif
#ifndef NDEBUG
@ -338,7 +338,7 @@ static void GBAProcessEvents(struct ARMCore* cpu) {
}
}
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
void GBAAttachDebugger(struct GBA* gba, struct mDebugger* debugger) {
gba->debugger = (struct ARMDebugger*) debugger->platform;
gba->debugger->setSoftwareBreakpoint = _setSoftwareBreakpoint;
@ -850,7 +850,7 @@ void GBAGetGameTitle(const struct GBA* gba, char* out) {
void GBAHitStub(struct ARMCore* cpu, uint32_t opcode) {
struct GBA* gba = (struct GBA*) cpu->master;
UNUSED(gba);
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
if (gba->debugger) {
struct mDebuggerEntryInfo info = {
.address = _ARMPCAddress(cpu),
@ -873,7 +873,7 @@ void GBAIllegal(struct ARMCore* cpu, uint32_t opcode) {
// TODO: More sensible category?
mLOG(GBA, WARN, "Illegal opcode: %08x", opcode);
}
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
if (gba->debugger) {
struct mDebuggerEntryInfo info = {
.address = _ARMPCAddress(cpu),
@ -888,7 +888,7 @@ void GBAIllegal(struct ARMCore* cpu, uint32_t opcode) {
void GBABreakpoint(struct ARMCore* cpu, int immediate) {
struct GBA* gba = (struct GBA*) cpu->master;
switch (immediate) {
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
case CPU_COMPONENT_DEBUGGER:
if (gba->debugger) {
struct mDebuggerEntryInfo info = {
@ -1053,7 +1053,7 @@ void GBAClearBreakpoint(struct GBA* gba, uint32_t address, enum ExecutionMode mo
}
}
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
static bool _setSoftwareBreakpoint(struct ARMDebugger* debugger, uint32_t address, enum ExecutionMode mode, uint32_t* opcode) {
GBASetBreakpoint((struct GBA*) debugger->cpu->master, &debugger->d.p->d, address, mode, opcode);
return true;

View File

@ -67,7 +67,7 @@ void free(void*);
#include <mgba/internal/gba/input.h>
#include <mgba/internal/gb/renderers/cache-set.h>
#endif
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
#include <mgba/debugger/debugger.h>
#include <mgba/internal/debugger/cli-debugger.h>
#endif

View File

@ -9,7 +9,7 @@
#include <mgba-util/string.h>
#include <mgba-util/vfs.h>
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
#include <mgba/debugger/debugger.h>
#endif
@ -23,7 +23,7 @@ static bool mPythonScriptEngineLoadScript(struct mScriptEngine*, const char* nam
static void mPythonScriptEngineRun(struct mScriptEngine*);
static bool mPythonScriptEngineLookupSymbol(struct mScriptEngine*, const char* name, int32_t* out);
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
static void mPythonScriptDebuggerEntered(struct mScriptEngine*, enum mDebuggerEntryReason, struct mDebuggerEntryInfo*);
#endif
@ -41,7 +41,7 @@ struct mPythonScriptEngine* mPythonCreateScriptEngine(void) {
engine->d.loadScript = mPythonScriptEngineLoadScript;
engine->d.run = mPythonScriptEngineRun;
engine->d.lookupSymbol = mPythonScriptEngineLookupSymbol;
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
engine->d.debuggerEntered = mPythonScriptDebuggerEntered;
#endif
engine->sb = NULL;
@ -82,7 +82,7 @@ bool mPythonScriptEngineLoadScript(struct mScriptEngine* se, const char* name, s
void mPythonScriptEngineRun(struct mScriptEngine* se) {
struct mPythonScriptEngine* engine = (struct mPythonScriptEngine*) se;
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
struct mDebugger* debugger = mScriptBridgeGetDebugger(engine->sb);
if (debugger) {
mPythonSetDebugger(debugger);
@ -97,7 +97,7 @@ bool mPythonScriptEngineLookupSymbol(struct mScriptEngine* se, const char* name,
return mPythonLookupSymbol(name, out);
}
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
void mPythonScriptDebuggerEntered(struct mScriptEngine* se, enum mDebuggerEntryReason reason, struct mDebuggerEntryInfo* info) {
struct mPythonScriptEngine* engine = (struct mPythonScriptEngine*) se;

View File

@ -6,7 +6,7 @@ extern bool mPythonLoadScript(const char*, struct VFile*);
extern void mPythonRunPending();
extern bool mPythonLookupSymbol(const char* name, int32_t* out);
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
extern void mPythonSetDebugger(struct mDebugger*);
extern void mPythonDebuggerEntered(enum mDebuggerEntryReason, struct mDebuggerEntryInfo*);
#endif

View File

@ -249,7 +249,7 @@ if(NOT AUDIO_SRC)
return()
endif()
if(USE_DEBUGGERS)
if(ENABLE_DEBUGGERS)
list(APPEND SOURCE_FILES
DebuggerController.cpp
DebuggerConsole.cpp
@ -257,7 +257,7 @@ if(USE_DEBUGGERS)
MemoryAccessLogView.cpp)
endif()
if(USE_GDB_STUB)
if(ENABLE_GDB_STUB)
list(APPEND SOURCE_FILES GDBController.cpp GDBWindow.cpp)
endif()

View File

@ -49,7 +49,7 @@ CoreController::CoreController(mCore* core, QObject* parent)
GBASIODolphinCreate(&m_dolphin);
#endif
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
mDebuggerInit(&m_debugger);
#endif
@ -218,7 +218,7 @@ CoreController::~CoreController() {
mCoreThreadJoin(&m_threadContext);
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
mDebuggerDeinit(&m_debugger);
#endif
@ -331,7 +331,7 @@ void CoreController::loadConfig(ConfigController* config) {
#endif
}
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
void CoreController::attachDebugger(bool interrupt) {
Interrupter interrupter(this);
if (!m_threadContext.core->debugger) {
@ -478,7 +478,7 @@ void CoreController::start() {
void CoreController::stop() {
setSync(false);
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
detachDebugger();
#endif
setPaused(false);

View File

@ -107,7 +107,7 @@ public:
mCheatDevice* cheatDevice() { return m_threadContext.core->cheatDevice(m_threadContext.core); }
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
mDebugger* debugger() { return &m_debugger; }
void attachDebugger(bool interrupt = true);
void detachDebugger();
@ -305,7 +305,7 @@ private:
bool m_autoload;
int m_autosaveCounter = 0;
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
struct mDebugger m_debugger;
#endif

View File

@ -7,7 +7,7 @@
#include "DebuggerController.h"
#ifdef USE_GDB_STUB
#ifdef ENABLE_GDB_STUB
#include <mgba/internal/debugger/gdb-stub.h>

View File

@ -211,7 +211,7 @@ void Window::argumentsPassed() {
m_pendingState = args->savestate;
}
#ifdef USE_GDB_STUB
#ifdef ENABLE_GDB_STUB
if (args->debugGdb) {
if (!m_gdbController) {
m_gdbController = new GDBController(this);
@ -224,7 +224,7 @@ void Window::argumentsPassed() {
}
#endif
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
if (args->debugCli) {
consoleOpen();
}
@ -607,7 +607,7 @@ std::function<void()> Window::openNamedControllerTView(std::unique_ptr<T>* name,
};
}
#ifdef USE_GDB_STUB
#ifdef ENABLE_GDB_STUB
void Window::gdbOpen() {
if (!m_gdbController) {
m_gdbController = new GDBController(this);
@ -619,7 +619,7 @@ void Window::gdbOpen() {
}
#endif
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
void Window::consoleOpen() {
if (!m_console) {
m_console = new DebuggerConsoleController(this);
@ -1677,14 +1677,14 @@ void Window::setupMenu(QMenuBar* menubar) {
m_actions.addAction(tr("Make portable"), "makePortable", this, &Window::tryMakePortable, "tools");
m_actions.addSeparator("tools");
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
m_actions.addAction(tr("Open debugger console..."), "debuggerWindow", this, &Window::consoleOpen, "tools");
#ifdef USE_GDB_STUB
#ifdef ENABLE_GDB_STUB
auto gdbWindow = addGameAction(tr("Start &GDB server..."), "gdbWindow", this, &Window::gdbOpen, "tools");
m_platformActions.insert(mPLATFORM_GBA, gdbWindow);
#endif
#endif
#if defined(USE_DEBUGGERS) || defined(ENABLE_SCRIPTING)
#if defined(ENABLE_DEBUGGERS) || defined(ENABLE_SCRIPTING)
m_actions.addSeparator("tools");
#endif
@ -1714,7 +1714,7 @@ void Window::setupMenu(QMenuBar* menubar) {
addGameAction(tr("Search memory..."), "memorySearch", openControllerTView<MemorySearch>(), "stateViews");
addGameAction(tr("View &I/O registers..."), "ioViewer", openControllerTView<IOViewer>(), "stateViews");
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
addGameAction(tr("Log memory &accesses..."), "memoryAccessView", openControllerTView<MemoryAccessLogView>(), "tools");
#endif
@ -2132,13 +2132,13 @@ void Window::setController(CoreController* controller, const QString& fname) {
}
#endif
#ifdef USE_GDB_STUB
#ifdef ENABLE_GDB_STUB
if (m_gdbController) {
m_gdbController->setController(m_controller);
}
#endif
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
if (m_console) {
m_console->setController(m_controller);
}

View File

@ -108,11 +108,11 @@ public slots:
void startVideoLog();
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
void consoleOpen();
#endif
#ifdef USE_GDB_STUB
#ifdef ENABLE_GDB_STUB
void gdbOpen();
#endif
@ -206,7 +206,7 @@ private:
LogController m_log{0};
LogView* m_logView;
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
DebuggerConsoleController* m_console = nullptr;
#endif
LoadSaveState* m_stateWindow = nullptr;
@ -249,7 +249,7 @@ private:
std::unique_ptr<GIFView> m_gifView;
#endif
#ifdef USE_GDB_STUB
#ifdef ENABLE_GDB_STUB
GDBController* m_gdbController = nullptr;
#endif

View File

@ -302,7 +302,7 @@ void ScriptingController::updateGamepad() {
void ScriptingController::attach() {
CoreController::Interrupter interrupter(m_controller);
mScriptContextAttachCore(&m_scriptContext, m_controller->thread()->core);
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
m_controller->attachDebugger(false);
#endif
}

View File

@ -217,12 +217,12 @@ int mSDLRun(struct mSDLRenderer* renderer, struct mArguments* args) {
#ifdef ENABLE_PYTHON
mPythonSetup(bridge);
#endif
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
CLIDebuggerScriptEngineInstall(bridge);
#endif
#endif
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
struct mDebugger debugger;
mDebuggerInit(&debugger);
bool hasDebugger = mArgumentsApplyDebugger(args, renderer->core, &debugger);
@ -292,7 +292,7 @@ int mSDLRun(struct mSDLRenderer* renderer, struct mArguments* args) {
mScriptBridgeDestroy(bridge);
#endif
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
if (hasDebugger) {
renderer->core->detachDebugger(renderer->core);
mDebuggerDeinit(&debugger);

View File

@ -505,7 +505,7 @@ static void _mSDLHandleKeypress(struct mCoreThread* context, struct mSDLPlayer*
}
if (event->type == SDL_KEYDOWN) {
switch (event->keysym.sym) {
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
case SDLK_F11:
if (context->core->debugger) {
mDebuggerEnter(context->core->debugger, DEBUGGER_ENTER_MANUAL, NULL);

View File

@ -139,7 +139,7 @@ int main(int argc, char * argv[]) {
goto loadError;
}
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
struct mDebugger debugger;
mDebuggerInit(&debugger);
bool hasDebugger = mArgumentsApplyDebugger(&args, core, &debugger);
@ -165,7 +165,7 @@ int main(int argc, char * argv[]) {
savestate->close(savestate);
}
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
if (hasDebugger) {
do {
mDebuggerRun(&debugger);
@ -178,7 +178,7 @@ int main(int argc, char * argv[]) {
core->unloadROM(core);
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
if (hasDebugger) {
core->detachDebugger(core);
mDebuggerDeinit(&debugger);

View File

@ -160,7 +160,7 @@ void mScriptContextAttachStdlib(struct mScriptContext* context) {
mSCRIPT_KV_SENTINEL
});
#endif
#ifdef USE_DEBUGGERS
#ifdef ENABLE_DEBUGGERS
mScriptContextExportConstants(context, "WATCHPOINT_TYPE", (struct mScriptKVPair[]) {
mSCRIPT_CONSTANT_PAIR(WATCHPOINT, WRITE),
mSCRIPT_CONSTANT_PAIR(WATCHPOINT, READ),