pcsx2 icon indicating copy to clipboard operation
pcsx2 copied to clipboard

[BUG] False positive function listings in debug window hiding correct symbols

Open escape209 opened this issue 4 years ago • 5 comments

Describe the bug In the Functions tab of the Debug Window, there are/may be several incorrect function symbols added, all with the naming scheme z_un_[memory address]. These false positives cause correct symbols to not be listed as they are considered to be a part of the incorrectly detected, non-existent function. image

In the above case, the symbol GetCrashWind__13CB4StageLogic13ERaceCarIndex comes after the incorrect symbol z_un_004339f0, which causes the latter to be listed in the Functions list instead of the former.

To Reproduce

  1. Boot up a game with debug symbols (in this case, Burnout Revenge Alpha 7 build, CRC 815B946C.
  2. Click Window -> Show Debug to open the Debug Window.
  3. Allow the game to progress past the initial loading stages.
  4. Click Break and wait for the Functions list to be populated.
  5. Scroll to the very bottom and there should be a lot of listings in the format z_un_[memory address].

Expected behavior

Expected the correct function listings to appear in the list instead of the incorrect ones. Because of this issue, hundreds of correct symbols do not appear in the list as they should.

A temporary workaround is to simply right click the incorrect function and click "Remove Function", then right click the correct one and click "Add Function Here." For such a huge number of these functions, though, this is clearly infeasible.

GS Settings

N/A

Emulation Settings

N/A

GS Window Screenshots

N/A

System Info (please complete the following information):

  • PCSX2 Revision: v1.7.0-dev-765
  • OS: Windows 10
  • CPU: Ryzen 5 3600
  • GPU: GTX 1650 SUPER

Logs and Dumps

B4EXTERN.MAP.txt

The game's .map file.

escape209 avatar Dec 19 '20 10:12 escape209

Can this be checked on latest nightly? :)

Mrlinkwii avatar Apr 09 '23 09:04 Mrlinkwii

Checked on latest nightly, still appears to be an issue. The symbols are interpreted fine in Ghidra using the ghidra-emotionengine-reloaded extension.

escape209 avatar Aug 17 '23 00:08 escape209

https://github.com/PCSX2/pcsx2/blob/3e225d78fafe9ef04717b94e1c68c14356468e4a/pcsx2/DebugTools/MIPSAnalyst.cpp#L121 Looks like this is the default function name in the MIPS analysis tool. It's only called once, and that's in the ScanForFunctions function.

TheTechnician27 avatar Feb 02 '24 03:02 TheTechnician27

nop function

Looking at this further, I 100% agree there are addresses which are falsely detected as functions and then given the default name (in this case, this was taken in ATV: Offroad Fury).

TheTechnician27 avatar Feb 04 '24 15:02 TheTechnician27

I don't see any reason why the function analyzer should be creating functions there. Which leads me to suspect that the game is either dynamically swapping code in and out, or the "main" game is actually a different ELF than the SLUS/SLES/etc that is first loaded. This is related to #2065, which I tried to fix when adding the refresh option to the function listing. Can someone see if the issue persists with #10224?

F0bes avatar Apr 18 '24 19:04 F0bes