Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PPCSymbolDB: Refactor SymbolMap Save/Load #13195

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sepalani
Copy link
Contributor

@sepalani sepalani commented Nov 24, 2024

This PR refactors parts of the loading/saving process of symbol map. I'm putting it as a draft for now as I'd like to wait for https://dolp.in/pr13113 to be merged first.

This PR fixes issues I had where some symbols weren't loaded properly (which might get saved later). Here are some examples on how they can alter existing symbol maps.

The alignment wasn't properly detected and 0 was detected as name by sscanf.

This issue was also caused by the namepos/strstr logic which is flawed when the name is small and equals to part of the symbol address, size or vaddress. Moreover, checking for a space doesn't work when alignment is 16. I've seen this alignment value on some *fill* symbols.

-80468370 00000008 80468370 0 TRKPositionFile (entry of .text)  TRK_Hollywood_Revolution.a C:\products\RVL\runtime_libs\debugger\embedded\MetroTRK\Processor\
+80468360 00000008 80468360 0 0468360 00000008 80468360 0 TRKPositionFile (entry of .text)      TRK_Hollywood_Revolution.a C:\products\RVL\runtime_libs\debugger\embedded\MetroTRK\Processor\

savegpr / loadgpr entry wasn't properly detected

This issue also trimmed the object names after the "entry of" part.

-80456e54 000018 80456e54 0 _restgpr_27 (entry of __restore_gpr)        Runtime.PPCEABI.H.a runtime.o
+80456e54 000018 80456e54 0 __restore_gpr::

This PR is ready to be reviewed and tested. I also advise people testing this PR to backup their symbol maps just in case or test this PR in a dedicated portable build.

@sepalani sepalani marked this pull request as ready for review December 9, 2024 17:51
@sepalani
Copy link
Contributor Author

sepalani commented Dec 9, 2024

As #13113 was merged, this PR is ready to be reviewed and tested.

@dreamsyntax
Copy link
Member

I assume I should be able to just load an existing symbol map, then re-save and this should apply?

@sepalani
Copy link
Contributor Author

I assume I should be able to just load an existing symbol map, then re-save and this should apply?

Indeed that should work. It won't restore symbols which have already damaged (e.g. _restgpr_27 becoming __restore_gpr::), though.

@dreamsyntax
Copy link
Member

dreamsyntax commented Dec 18, 2024

If I have my map file in the \maps folder and use this build, Dolphin crashes on game boot (flatpak x64).

/app/bin/dolphin-emu-wrapper: line 6:    13 Aborted                 (core dumped) dolphin-emu "$@"

If I have no map file, boot the game, place the map file in \maps folder, and then choose Load Map
Dolphin hangs until I try to do another action, then crashes.

This is my map incase it's useful:
https://raw.githubusercontent.com/ShadowTheHedgehogHacking/shadow-symbols-and-dmw/refs/heads/main/GUPE8P.map

I verified the latest dev flatpak works as expected with the map.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants