Skip to content

Add GDB Stub

Coxxs requested to merge coxxs/ryujinx:gdb-stub into master

GDB Stub cherry picked manually from Ryujinx#5804 (Author: merry, svc64)

I modified some code to make it compatible with the latest Ryujinx and my device. I also made some improvements / changes to make it more usable:

  • Thread names will now be displayed in gdb and GetGuestStackTrace
  • Fixed breakpoints/stepping for AArch32 applications
  • Fixed stepping of branch instructions
    • When using si in gdb, gdb should correctly enter bl and other branch instructions now.
  • Support precise tracking of PC value when GDB Stub is enabled
    • This is done by inserting an instruction before each instruction to set the current PC to the NativeContext.
    • This will affect performance, so it's only enabled when GDB Stub is enabled in Settings.
    • This also means when GDB Stub is enabled, the PC value in crash logs will be more accurate.
  • Added some monitor command in gdb
    • monitor help - list all available monitor commands
    • monitor backtrace (mo bt) - show stack trace for the current thread, use Ryujinx GetGuestStackTrace
    • monitor registers (mo reg) - display register values for the current thread, use Ryujinx GetCpuRegisterPrintout
    • monitor get info - show process information like memory layout and loaded modules
  • On Windows arm64, when GDB Stub is enabled, Ryujinx will now use Ryujinx.Cpu.Jit (ARMeilleure) instead of Ryujinx.Cpu.LightningJit, because debugging support was not added to Ryujinx.Cpu.LightningJit.
    • I did not test this part.
  • On macOS, Ryujinx uses Ryujinx.Cpu.AppleHv.
    • Debugging support was added to Ryujinx.Cpu.AppleHv in the original pull request (Ryujinx#5804). I did not test this part.

I'm using it on Windows x64, It wasn't tested on other platforms: e.g. macOS, Windows arm64. (I don't have these devices, and issues on these platform will probably be too difficult for me to fix...)

If anyone is interested, feel free to fork and improve it.

image

Edited by Coxxs

Merge request reports

Loading