Skip to content

Commit

Permalink
GBA Core: Fix loading symbols from ELF files if the file doesn't end …
Browse files Browse the repository at this point in the history
…with .elf
  • Loading branch information
endrift committed Jul 7, 2024
1 parent 5ebf382 commit 4c161ff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,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 savestate preview sizes with different scales (fixes mgba.io/i/2560)
- Qt: Fix potential crash when configuring shortcuts
Expand Down
11 changes: 11 additions & 0 deletions src/gba/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,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();
Expand All @@ -1263,6 +1264,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;
}
Expand Down

0 comments on commit 4c161ff

Please sign in to comment.