DS Core: Backport symbol loading changes from GBA core (fixes #1834)

This commit is contained in:
Vicki Pfau 2020-07-30 19:08:55 -07:00
parent 99d7c588e7
commit c62d913e23
2 changed files with 15 additions and 2 deletions

View File

@ -29,6 +29,7 @@ Misc:
- DS Core: Add symbol loading
- DS Video: Simplify VRAM mapping
- DS GX: Reject and log polygons that clip to more than 10 vertices
- DS Core: Backport symbol loading changes from GBA core (fixes mgba.io/i/1834)
0.9.0: (Future)
Features:

View File

@ -83,6 +83,7 @@ static bool _DSCoreInit(struct mCore* core) {
core->board = ds;
core->timing = &ds->ds9.timing;
core->debugger = NULL;
core->symbolTable = NULL;
dscore->arm7 = arm7;
dscore->arm9 = arm9;
dscore->debuggerPlatform = NULL;
@ -596,27 +597,38 @@ static void _DSCoreDetachDebugger(struct mCore* core) {
}
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
#ifdef USE_ELF
if (!vf) {
closeAfter = true;
vf = mDirectorySetOpenSuffix(&core->dirs, core->dirs.base, ".elf", O_RDONLY);
}
#endif
if (!vf) {
closeAfter = true;
vf = mDirectorySetOpenSuffix(&core->dirs, core->dirs.base, ".sym", O_RDONLY);
}
#endif
if (!vf) {
return;
}
#ifdef USE_ELF
struct ELF* elf = ELFOpen(vf);
if (elf) {
#ifdef USE_DEBUGGERS
mCoreLoadELFSymbols(core->symbolTable, elf);
#endif
ELFClose(elf);
} else
#endif
{
mDebuggerLoadARMIPSSymbols(core->symbolTable, vf);
}
if (closeAfter) {
vf->close(vf);
}
#endif
}
static bool _DSCoreLookupIdentifier(struct mCore* core, const char* name, int32_t* value, int* segment) {