mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-17 16:30:30 +02:00
SymbolMap had no coverage. It stores symbols relative to a module so they survive that module being unloaded and reloaded elsewhere, and only symbols belonging to a loaded module count as active - that indirection is where the surprises are, so the tests concentrate on module lifetime and the shared label table. Writing them turned up a real bug. UpdateActiveSymbols() bailed out early when activeModuleEnds was empty, as a "tiny optimization" for startup and shutdown, having already cleared the active maps. But symbols with module index 0 are absolute by design - they belong to no module, which is how you label a heap or stack address - and the loops it skipped are exactly what keeps those alive. So an absolute symbol disappeared as soon as the last module was unloaded, and didn't exist at all before the first one was loaded. Dropping activeModuleEnds from the early-out condition fixes it; the symbol-count half still gives the intended fast path when there's nothing to do. Tests cover function and data lookup by containing address, SetFunctionSize, RemoveFunction/RemoveData, symbols surviving an unload/reload at a different address, absolute (module 0) symbols, GetSymbolInfo/GetDescription, and Clear. Two of them pin down behaviour that catches people out rather than asserting it's right: AddLabel deliberately won't overwrite an existing label, and because functions and data share one label table, renaming or removing via one affects the other. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GZq8ZtJmFY7bkX5FVkr3P9