From 5ac23cfe4fc1a27f4c61db4c1d5e046d6c758f88 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sun, 7 Jul 2024 11:13:32 -0700 Subject: [PATCH] GBA Core: Fix loading symbols from ELF files if the file doesn't end with .elf --- CHANGES | 1 + src/gba/core.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/CHANGES b/CHANGES index d1795582b..a889e7250 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,7 @@ Other fixes: - GB, GBA Core: Fix memory leak if reloading debug symbols - GBA Audio: Fix crash if audio FIFOs and timers get out of sync - GBA Audio: Fix crash in audio subsampling if timing lockstep breaks + - GBA Core: Fix loading symbols from ELF files if the file doesn't end with .elf - GBA Memory: Let raw access read high MMIO addresses - Qt: Fix crash when applying changes to GB I/O registers in I/O view - Qt: Fix LCDC background priority/enable bit being mis-mapped in I/O view diff --git a/src/gba/core.c b/src/gba/core.c index cbe85e10f..03c7bc0ad 100644 --- a/src/gba/core.c +++ b/src/gba/core.c @@ -1112,6 +1112,7 @@ static void _GBACoreDetachDebugger(struct mCore* core) { } static void _GBACoreLoadSymbols(struct mCore* core, struct VFile* vf) { + struct GBA* gba = core->board; bool closeAfter = false; if (!core->symbolTable) { core->symbolTable = mDebuggerSymbolTableCreate(); @@ -1133,6 +1134,16 @@ static void _GBACoreLoadSymbols(struct mCore* core, struct VFile* vf) { vf = mDirectorySetOpenSuffix(&core->dirs, core->dirs.base, ".sym", O_RDONLY); } #endif + if (!vf && gba->mbVf) { + vf = gba->mbVf; + seek = vf->seek(vf, 0, SEEK_CUR); + vf->seek(vf, 0, SEEK_SET); + } + if (!vf && gba->romVf) { + vf = gba->romVf; + seek = vf->seek(vf, 0, SEEK_CUR); + vf->seek(vf, 0, SEEK_SET); + } if (!vf) { return; }