all repos — mgba @ f80bcfaf5dc3847aa17281906ce52f33fa01953c

mGBA Game Boy Advance Emulator

DS Core: Add symbol loading
Vicki Pfau vi@endrift.com
Sun, 16 Jul 2017 14:43:48 -0700
commit

f80bcfaf5dc3847aa17281906ce52f33fa01953c

parent

3bc8ed4e92b9eee5ab71987bfe89970ecf055156

2 files changed, 28 insertions(+), 0 deletions(-)

jump to
M CHANGESCHANGES

@@ -6,6 +6,7 @@ - DS GX: Fix vertex texture transformation (fixes mgba.io/i/702)

- DS GX: Automatically normalize winding culling calculations (fixes mgba.io/i/699) Misc: - DS GX: Clean up and unify texture mapping + - DS Core: Add symbol loading 0.7.0: (Future) Features:
M src/ds/core.csrc/ds/core.c

@@ -9,11 +9,13 @@ #include <mgba/core/cheats.h>

#include <mgba/core/core.h> #include <mgba/core/log.h> #include <mgba/internal/arm/debugger/debugger.h> +#include <mgba/internal/debugger/symbols.h> #include <mgba/internal/ds/ds.h> #include <mgba/internal/ds/extra/cli.h> #include <mgba/internal/ds/gx/software.h> #include <mgba/internal/ds/input.h> #include <mgba/internal/ds/renderers/software.h> +#include <mgba-util/elf-read.h> #include <mgba-util/memory.h> #include <mgba-util/patch.h> #include <mgba-util/vfs.h>

@@ -536,6 +538,30 @@ static void _DSCoreDetachDebugger(struct mCore* core) {

DSDetachDebugger(core->board); core->debugger = NULL; } + +static void _DSCoreLoadSymbols(struct mCore* core, struct VFile* vf) { +#ifdef USE_ELF + bool closeAfter = false; + core->symbolTable = mDebuggerSymbolTableCreate(); +#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2 + if (!vf) { + closeAfter = true; + vf = mDirectorySetOpenSuffix(&core->dirs, core->dirs.base, ".elf", O_RDONLY); + } +#endif + if (!vf) { + return; + } + struct ELF* elf = ELFOpen(vf); + if (elf) { + mCoreLoadELFSymbols(core->symbolTable, elf); + ELFClose(elf); + } + if (closeAfter) { + vf->close(vf); + } +#endif +} #endif static struct mCheatDevice* _DSCoreCheatDevice(struct mCore* core) {

@@ -657,6 +683,7 @@ core->debuggerPlatform = _DSCoreDebuggerPlatform;

core->cliDebuggerSystem = _DSCoreCliDebuggerSystem; core->attachDebugger = _DSCoreAttachDebugger; core->detachDebugger = _DSCoreDetachDebugger; + core->loadSymbols = _DSCoreLoadSymbols; #endif core->cheatDevice = _DSCoreCheatDevice; core->savedataClone = _DSCoreSavedataClone;