Overview
Effective debugging is essential for developing and troubleshooting Ryujinx. This guide covers debugging tools, techniques, and common issues developers encounter.Make sure you’ve built Ryujinx in Debug configuration before following this guide.
Debug Build Configuration
Building for Debugging
Debug vs Release
IDE Debugging
Visual Studio (Windows)
1
Set startup project
Right-click
Ryujinx project → Set as Startup Project2
Set breakpoints
Click in the left margin next to line numbers to add breakpoints
3
Start debugging
Press F5 or select Debug → Start Debugging
4
Debug controls
- F10: Step Over
- F11: Step Into
- Shift+F11: Step Out
- F5: Continue
- Shift+F5: Stop Debugging
Visual Studio Code
1
Install C# Dev Kit
Install the C# Dev Kit extension
2
Create launch configuration
Create
.vscode/launch.json:3
Create build task
Create
.vscode/tasks.json:4
Start debugging
Press F5 or select Run → Start Debugging
JetBrains Rider
1
Open solution
Open
Ryujinx.sln2
Set run configuration
Select Ryujinx as the run configuration
3
Set breakpoints
Click in the gutter next to line numbers
4
Start debugging
Press Shift+F9 or click the debug icon
Common Debugging Scenarios
Debugging GPU Operations
GPU-related code is insrc/Ryujinx.Graphics.Gpu/:
Debugging CPU Emulation
CPU emulation code is insrc/ARMeilleure/:
Debugging HLE Services
High-level emulated services are insrc/Ryujinx.HLE/:
Logging
Using Ryujinx Logger
Ryujinx uses a custom logging system fromRyujinx.Common.Logging:
Log Classes
Common log classes:Viewing Logs
- Console Output
- Log Files
Debug builds output logs to the console in real-time
Memory Debugging
Memory Management
Ryujinx has custom memory management insrc/Ryujinx.Memory/:
Detecting Memory Leaks
1
Use .NET memory profiling
Visual Studio and Rider have built-in memory profilers
2
Enable GC logging
3
Use diagnostic tools
Performance Profiling
See the dedicated Performance guide for detailed profiling techniques.Quick Profiling
Conditional Compilation
Debug-Only Code
Platform-Specific Debugging
Crash Debugging
Stack Traces
When Ryujinx crashes, check:- Console output for exception details
- Log files for the last operations
- Crash dumps if available
Exception Handling
Common Issues
Breakpoints not hitting
Breakpoints not hitting
Cause: Running Release build or optimizations enabledFix:
Symbols not loading
Symbols not loading
Cause: PDB files not generated or in wrong locationFix: Rebuild in Debug mode with full debug symbols:
Performance too slow in Debug
Performance too slow in Debug
Cause: Debug builds have all optimizations disabledFix: Use Release build for performance testing, Debug only when actively debugging
Can't inspect variables
Can't inspect variables
Cause: Variables optimized away in Release buildFix: Switch to Debug build or use
[MethodImpl(MethodImplOptions.NoOptimization)]Advanced Debugging
Debugging Tests
Fromsrc/Ryujinx.Tests/:
- Right-click on test method
- Select Debug Test
Attach to Running Process
- Visual Studio
- VS Code
- Command Line
- Debug → Attach to Process
- Select
Ryujinx.exeordotnet.exe - Click Attach
Remote Debugging
For debugging on another machine or in Docker:Debugging Tools
.NET Diagnostic Tools
Third-Party Tools
- dotMemory: Memory profiling
- dotTrace: Performance profiling
- PerfView: Free performance analysis
- BenchmarkDotNet: Micro-benchmarking
Tips and Best Practices
Use conditional breakpoints
Right-click breakpoint → Conditions to break only when specific conditions are met
Use data breakpoints
Break when a specific variable’s value changes (VS/Rider)
Use tracepoints
Log messages without stopping execution (like adding Logger calls)
Check the Immediate Window
Execute code and inspect variables at runtime (VS)
Next Steps
Testing
Write unit tests to prevent bugs
Performance
Profile and optimize code
Contributing
Submit your fixes