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

Improved Lightrec Debug #351

Merged
merged 3 commits into from
Jan 20, 2025
Merged

Improved Lightrec Debug #351

merged 3 commits into from
Jan 20, 2025

Conversation

pcercuei
Copy link
Contributor

Allow to compile with LIGHTREC_DEBUG=1, which will set Lightrec's log level to debug mode, enable its built-in PSX code disassembler, the JIT disassembler, and enable support for the "big-ass debugger".

The latter will run the standalone build of PCSX in parallel with Lightrec's interpreter vs. its dynarec, and periodically compare their behaviour.

By default, the emulator will print a checksum of the registers after each exit point. When a mismatch is found, it is advised to re-start the debugging setting the LIGHTREC_VERY_DEBUG=1 environment variable, and to set the LIGHTREC_BEGIN_CYCLES environment variable to the cycle value of the last known state. When the "very debug" mode is used, the interpreter and dynarec will exit after each single block, and the emulator will compute a checksum of the whole RAM and scratchpad and print all registers. This two-level debugging allows to find a mismatch point very fast, and then fine-tune until the exact breaking point is found.

This is porting some code from my old pcsx_rearmed fork, which is just way too old to allow me to debug anything anymore. While it does not necesarily need to be in upstream pcsx_rearmed, it would make my life easier.

When set, Lightrec will be built with the debug log level, the built-in
disassembler for PSX code and JIT code (requires binutils), and support
outputing data to the big-ass debugger (if the proper environment
variables are set).

Signed-off-by: Paul Cercueil <[email protected]>
These optimizations cause Lightrec's interpreter and dynarec to have
different behaviours.

Signed-off-by: Paul Cercueil <[email protected]>
This debugger has this name because it doesn't even try to be suttle -
it will run the dynarec and interpreter versions of Lightrec in
parallel, comparing their behaviour at every exit point, and returning
any issue as soon as they appear.

By default, the emulator will print a checksum of the registers after
each exit point. When a mismatch is found, it is advised to re-start the
debugging setting the LIGHTREC_VERY_DEBUG=1 environment variable, and to
set the LIGHTREC_BEGIN_CYCLES environment variable to the cycle value of
the last known state. When the "very debug" mode is used, the
interpreter and dynarec will exit after each single block, and the
emulator will compute a checksum of the whole RAM and scratchpad and
print all registers. This two-level debugging allows to find a mismatch
point very fast, and then fine-tune until the exact breaking point is
found.

Signed-off-by: Paul Cercueil <[email protected]>
@notaz notaz merged commit ea9687a into notaz:master Jan 20, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants