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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -64,7 +64,7 @@ static void _seRun(const char* key, void* value, void* user) {
se->run(se); se->run(se);
} }
#ifdef USE_DEBUGGERS #ifdef ENABLE_DEBUGGERS
struct mScriptDebuggerEntry { struct mScriptDebuggerEntry {
enum mDebuggerEntryReason reason; enum mDebuggerEntryReason reason;
struct mDebuggerEntryInfo* info; struct mDebuggerEntryInfo* info;
@ -98,7 +98,7 @@ void mScriptBridgeInstallEngine(struct mScriptBridge* sb, struct mScriptEngine*
HashTableInsert(&sb->engines, name, se); HashTableInsert(&sb->engines, name, se);
} }
#ifdef USE_DEBUGGERS #ifdef ENABLE_DEBUGGERS
void mScriptBridgeSetDebugger(struct mScriptBridge* sb, struct mDebugger* debugger) { void mScriptBridgeSetDebugger(struct mScriptBridge* sb, struct mDebugger* debugger) {
if (sb->debugger == debugger) { if (sb->debugger == debugger) {
return; return;
@ -159,7 +159,7 @@ struct mScriptMemoryDomain {
struct mCoreMemoryBlock block; struct mCoreMemoryBlock block;
}; };
#ifdef USE_DEBUGGERS #ifdef ENABLE_DEBUGGERS
struct mScriptBreakpointName { struct mScriptBreakpointName {
uint32_t address; uint32_t address;
uint32_t maxAddress; uint32_t maxAddress;
@ -189,7 +189,7 @@ struct mScriptCoreAdapter {
struct mCore* core; struct mCore* core;
struct mScriptContext* context; struct mScriptContext* context;
struct mScriptValue memory; struct mScriptValue memory;
#ifdef USE_DEBUGGERS #ifdef ENABLE_DEBUGGERS
struct mScriptDebugger debugger; struct mScriptDebugger debugger;
#endif #endif
struct mRumble rumble; 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) { static void _freeBreakpoint(void* bp) {
struct mScriptBreakpoint* point = bp; struct mScriptBreakpoint* point = bp;
HashTableDeinit(&point->callbacks); HashTableDeinit(&point->callbacks);
@ -929,7 +929,7 @@ static bool _mScriptCoreAdapterClearBreakpoint(struct mScriptCoreAdapter* adapte
static void _mScriptCoreAdapterDeinit(struct mScriptCoreAdapter* adapter) { static void _mScriptCoreAdapterDeinit(struct mScriptCoreAdapter* adapter) {
_clearMemoryMap(adapter->context, adapter, false); _clearMemoryMap(adapter->context, adapter, false);
adapter->memory.type->free(&adapter->memory); adapter->memory.type->free(&adapter->memory);
#ifdef USE_DEBUGGERS #ifdef ENABLE_DEBUGGERS
if (adapter->core->debugger) { if (adapter->core->debugger) {
mDebuggerDetachModule(adapter->core->debugger, &adapter->debugger.d); 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_VOID_METHOD(mScriptCoreAdapter, reset, _mScriptCoreAdapterReset, 0);
mSCRIPT_DECLARE_STRUCT_METHOD(mScriptCoreAdapter, WTABLE, setRotationCallbacks, _mScriptCoreAdapterSetRotationCbTable, 1, WTABLE, cbTable); mSCRIPT_DECLARE_STRUCT_METHOD(mScriptCoreAdapter, WTABLE, setRotationCallbacks, _mScriptCoreAdapterSetRotationCbTable, 1, WTABLE, cbTable);
mSCRIPT_DECLARE_STRUCT_VOID_METHOD(mScriptCoreAdapter, setSolarSensorCallback, _mScriptCoreAdapterSetLuminanceCb, 1, WRAPPER, callback); 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, 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, 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); 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." "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) mSCRIPT_DEFINE_STRUCT_METHOD(mScriptCoreAdapter, setSolarSensorCallback)
#ifdef USE_DEBUGGERS #ifdef ENABLE_DEBUGGERS
mSCRIPT_DEFINE_DOCSTRING("Set a breakpoint at a given address") mSCRIPT_DEFINE_DOCSTRING("Set a breakpoint at a given address")
mSCRIPT_DEFINE_STRUCT_METHOD(mScriptCoreAdapter, setBreakpoint) mSCRIPT_DEFINE_STRUCT_METHOD(mScriptCoreAdapter, setBreakpoint)
mSCRIPT_DEFINE_DOCSTRING("Clear a breakpoint or watchpoint for a given id returned by a previous call") 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; TEARDOWN_CORE;
} }
#ifdef USE_DEBUGGERS #ifdef ENABLE_DEBUGGERS
void _setupBp(struct mCore* core) { void _setupBp(struct mCore* core) {
switch (core->platform(core)) { switch (core->platform(core)) {
#ifdef M_CORE_GBA #ifdef M_CORE_GBA
@ -727,7 +727,7 @@ M_TEST_SUITE_DEFINE_SETUP_TEARDOWN(mScriptCore,
cmocka_unit_test(memoryWrite), cmocka_unit_test(memoryWrite),
cmocka_unit_test(logging), cmocka_unit_test(logging),
cmocka_unit_test(screenshot), cmocka_unit_test(screenshot),
#ifdef USE_DEBUGGERS #ifdef ENABLE_DEBUGGERS
#ifdef M_CORE_GBA #ifdef M_CORE_GBA
cmocka_unit_test(basicBreakpointGBA), cmocka_unit_test(basicBreakpointGBA),
#endif #endif

View File

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

View File

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

View File

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

View File

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

View File

@ -12,7 +12,7 @@
#include <mgba-util/string.h> #include <mgba-util/string.h>
#include <mgba-util/vfs.h> #include <mgba-util/vfs.h>
#ifdef USE_GDB_STUB #ifdef ENABLE_GDB_STUB
#include <mgba/internal/debugger/gdb-stub.h> #include <mgba/internal/debugger/gdb-stub.h>
#endif #endif
#ifdef USE_EDITLINE #ifdef USE_EDITLINE
@ -40,7 +40,7 @@ static const struct option _options[] = {
#ifdef USE_EDITLINE #ifdef USE_EDITLINE
{ "debug", no_argument, 0, 'd' }, { "debug", no_argument, 0, 'd' },
#endif #endif
#ifdef USE_GDB_STUB #ifdef ENABLE_GDB_STUB
{ "gdb", no_argument, 0, 'g' }, { "gdb", no_argument, 0, 'g' },
#endif #endif
{ "help", no_argument, 0, 'h' }, { "help", no_argument, 0, 'h' },
@ -85,7 +85,7 @@ bool mArgumentsParse(struct mArguments* args, int argc, char* const* argv, struc
#ifdef USE_EDITLINE #ifdef USE_EDITLINE
"d" "d"
#endif #endif
#ifdef USE_GDB_STUB #ifdef ENABLE_GDB_STUB
"g" "g"
#endif #endif
; ;
@ -151,7 +151,7 @@ bool mArgumentsParse(struct mArguments* args, int argc, char* const* argv, struc
args->debugCli = true; args->debugCli = true;
break; break;
#endif #endif
#ifdef USE_GDB_STUB #ifdef ENABLE_GDB_STUB
case 'g': case 'g':
args->debugAtStart = true; args->debugAtStart = true;
args->debugGdb = true; args->debugGdb = true;
@ -231,7 +231,7 @@ bool mArgumentsApplyDebugger(const struct mArguments* args, struct mCore* core,
} }
#endif #endif
#ifdef USE_GDB_STUB #ifdef ENABLE_GDB_STUB
if (args->debugGdb) { if (args->debugGdb) {
struct mDebuggerModule* module = mDebuggerCreateModule(DEBUGGER_GDB, core); struct mDebuggerModule* module = mDebuggerCreateModule(DEBUGGER_GDB, core);
if (module) { if (module) {
@ -355,7 +355,7 @@ void usage(const char* arg0, const char* prologue, const char* epilogue, const s
#ifdef USE_EDITLINE #ifdef USE_EDITLINE
" -d, --debug Use command-line debugger\n" " -d, --debug Use command-line debugger\n"
#endif #endif
#ifdef USE_GDB_STUB #ifdef ENABLE_GDB_STUB
" -g, --gdb Start GDB session (default port 2345)\n" " -g, --gdb Start GDB session (default port 2345)\n"
#endif #endif
" -l, --log-level N Log level mask\n" " -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 #if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
mDirectorySetDeinit(&core->dirs); mDirectorySetDeinit(&core->dirs);
#endif #endif
#ifdef USE_DEBUGGERS #ifdef ENABLE_DEBUGGERS
if (core->symbolTable) { if (core->symbolTable) {
mDebuggerSymbolTableDestroy(core->symbolTable); mDebuggerSymbolTableDestroy(core->symbolTable);
} }
@ -1060,7 +1060,7 @@ static bool _GBCoreWriteRegister(struct mCore* core, const char* name, const voi
return false; return false;
} }
#ifdef USE_DEBUGGERS #ifdef ENABLE_DEBUGGERS
static bool _GBCoreSupportsDebuggerType(struct mCore* core, enum mDebuggerType type) { static bool _GBCoreSupportsDebuggerType(struct mCore* core, enum mDebuggerType type) {
UNUSED(core); UNUSED(core);
switch (type) { switch (type) {
@ -1352,7 +1352,7 @@ struct mCore* GBCoreCreate(void) {
core->listRegisters = _GBCoreListRegisters; core->listRegisters = _GBCoreListRegisters;
core->readRegister = _GBCoreReadRegister; core->readRegister = _GBCoreReadRegister;
core->writeRegister = _GBCoreWriteRegister; core->writeRegister = _GBCoreWriteRegister;
#ifdef USE_DEBUGGERS #ifdef ENABLE_DEBUGGERS
core->supportsDebuggerType = _GBCoreSupportsDebuggerType; core->supportsDebuggerType = _GBCoreSupportsDebuggerType;
core->debuggerPlatform = _GBCoreDebuggerPlatform; core->debuggerPlatform = _GBCoreDebuggerPlatform;
core->cliDebuggerSystem = _GBCoreCliDebuggerSystem; core->cliDebuggerSystem = _GBCoreCliDebuggerSystem;

View File

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

View File

@ -313,7 +313,7 @@ static void _GBACoreDeinit(struct mCore* core) {
#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2 #if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
mDirectorySetDeinit(&core->dirs); mDirectorySetDeinit(&core->dirs);
#endif #endif
#ifdef USE_DEBUGGERS #ifdef ENABLE_DEBUGGERS
if (core->symbolTable) { if (core->symbolTable) {
mDebuggerSymbolTableDestroy(core->symbolTable); mDebuggerSymbolTableDestroy(core->symbolTable);
} }
@ -1218,7 +1218,7 @@ static bool _GBACoreWriteRegister(struct mCore* core, const char* name, const vo
return true; return true;
} }
#ifdef USE_DEBUGGERS #ifdef ENABLE_DEBUGGERS
static bool _GBACoreSupportsDebuggerType(struct mCore* core, enum mDebuggerType type) { static bool _GBACoreSupportsDebuggerType(struct mCore* core, enum mDebuggerType type) {
UNUSED(core); UNUSED(core);
switch (type) { switch (type) {
@ -1280,7 +1280,7 @@ static void _GBACoreLoadSymbols(struct mCore* core, struct VFile* vf) {
#ifdef USE_ELF #ifdef USE_ELF
struct ELF* elf = ELFOpen(vf); struct ELF* elf = ELFOpen(vf);
if (elf) { if (elf) {
#ifdef USE_DEBUGGERS #ifdef ENABLE_DEBUGGERS
mCoreLoadELFSymbols(core->symbolTable, elf); mCoreLoadELFSymbols(core->symbolTable, elf);
#endif #endif
ELFClose(elf); ELFClose(elf);
@ -1565,7 +1565,7 @@ struct mCore* GBACoreCreate(void) {
core->listRegisters = _GBACoreListRegisters; core->listRegisters = _GBACoreListRegisters;
core->readRegister = _GBACoreReadRegister; core->readRegister = _GBACoreReadRegister;
core->writeRegister = _GBACoreWriteRegister; core->writeRegister = _GBACoreWriteRegister;
#ifdef USE_DEBUGGERS #ifdef ENABLE_DEBUGGERS
core->supportsDebuggerType = _GBACoreSupportsDebuggerType; core->supportsDebuggerType = _GBACoreSupportsDebuggerType;
core->debuggerPlatform = _GBACoreDebuggerPlatform; core->debuggerPlatform = _GBACoreDebuggerPlatform;
core->cliDebuggerSystem = _GBACoreCliDebuggerSystem; 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); 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 bool _setSoftwareBreakpoint(struct ARMDebugger*, uint32_t address, enum ExecutionMode mode, uint32_t* opcode);
static void _clearSoftwareBreakpoint(struct ARMDebugger*, const struct ARMDebugBreakpoint*); static void _clearSoftwareBreakpoint(struct ARMDebugger*, const struct ARMDebugBreakpoint*);
#endif #endif
@ -305,7 +305,7 @@ static void GBAProcessEvents(struct ARMCore* cpu) {
do { do {
int32_t cycles = cpu->cycles; int32_t cycles = cpu->cycles;
cpu->cycles = 0; cpu->cycles = 0;
#ifdef USE_DEBUGGERS #ifdef ENABLE_DEBUGGERS
gba->timing.globalCycles += cycles < nextEvent ? nextEvent : cycles; gba->timing.globalCycles += cycles < nextEvent ? nextEvent : cycles;
#endif #endif
#ifndef NDEBUG #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) { void GBAAttachDebugger(struct GBA* gba, struct mDebugger* debugger) {
gba->debugger = (struct ARMDebugger*) debugger->platform; gba->debugger = (struct ARMDebugger*) debugger->platform;
gba->debugger->setSoftwareBreakpoint = _setSoftwareBreakpoint; gba->debugger->setSoftwareBreakpoint = _setSoftwareBreakpoint;
@ -850,7 +850,7 @@ void GBAGetGameTitle(const struct GBA* gba, char* out) {
void GBAHitStub(struct ARMCore* cpu, uint32_t opcode) { void GBAHitStub(struct ARMCore* cpu, uint32_t opcode) {
struct GBA* gba = (struct GBA*) cpu->master; struct GBA* gba = (struct GBA*) cpu->master;
UNUSED(gba); UNUSED(gba);
#ifdef USE_DEBUGGERS #ifdef ENABLE_DEBUGGERS
if (gba->debugger) { if (gba->debugger) {
struct mDebuggerEntryInfo info = { struct mDebuggerEntryInfo info = {
.address = _ARMPCAddress(cpu), .address = _ARMPCAddress(cpu),
@ -873,7 +873,7 @@ void GBAIllegal(struct ARMCore* cpu, uint32_t opcode) {
// TODO: More sensible category? // TODO: More sensible category?
mLOG(GBA, WARN, "Illegal opcode: %08x", opcode); mLOG(GBA, WARN, "Illegal opcode: %08x", opcode);
} }
#ifdef USE_DEBUGGERS #ifdef ENABLE_DEBUGGERS
if (gba->debugger) { if (gba->debugger) {
struct mDebuggerEntryInfo info = { struct mDebuggerEntryInfo info = {
.address = _ARMPCAddress(cpu), .address = _ARMPCAddress(cpu),
@ -888,7 +888,7 @@ void GBAIllegal(struct ARMCore* cpu, uint32_t opcode) {
void GBABreakpoint(struct ARMCore* cpu, int immediate) { void GBABreakpoint(struct ARMCore* cpu, int immediate) {
struct GBA* gba = (struct GBA*) cpu->master; struct GBA* gba = (struct GBA*) cpu->master;
switch (immediate) { switch (immediate) {
#ifdef USE_DEBUGGERS #ifdef ENABLE_DEBUGGERS
case CPU_COMPONENT_DEBUGGER: case CPU_COMPONENT_DEBUGGER:
if (gba->debugger) { if (gba->debugger) {
struct mDebuggerEntryInfo info = { 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) { 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); GBASetBreakpoint((struct GBA*) debugger->cpu->master, &debugger->d.p->d, address, mode, opcode);
return true; return true;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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