Skip to main content

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 Project
2

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

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.sln
2

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 in src/Ryujinx.Graphics.Gpu/:

Debugging CPU Emulation

CPU emulation code is in src/ARMeilleure/:
CPU emulation debugging can be extremely slow due to the high frequency of instruction execution.

Debugging HLE Services

High-level emulated services are in src/Ryujinx.HLE/:

Logging

Using Ryujinx Logger

Ryujinx uses a custom logging system from Ryujinx.Common.Logging:

Log Classes

Common log classes:

Viewing Logs

Debug builds output logs to the console in real-time

Memory Debugging

Memory Management

Ryujinx has custom memory management in src/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:
  1. Console output for exception details
  2. Log files for the last operations
  3. Crash dumps if available

Exception Handling

Common Issues

Cause: Running Release build or optimizations enabledFix:
Cause: PDB files not generated or in wrong locationFix: Rebuild in Debug mode with full debug symbols:
Cause: Debug builds have all optimizations disabledFix: Use Release build for performance testing, Debug only when actively debugging
Cause: Variables optimized away in Release buildFix: Switch to Debug build or use [MethodImpl(MethodImplOptions.NoOptimization)]

Advanced Debugging

Debugging Tests

From src/Ryujinx.Tests/:
In IDE:
  1. Right-click on test method
  2. Select Debug Test

Attach to Running Process

  1. Debug → Attach to Process
  2. Select Ryujinx.exe or dotnet.exe
  3. Click Attach

Remote Debugging

For debugging on another machine or in Docker:

Debugging Tools

.NET Diagnostic Tools

Third-Party Tools

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)
Hot Reload is supported in .NET 10.0 - make code changes while debugging without restarting!

Next Steps

Testing

Write unit tests to prevent bugs

Performance

Profile and optimize code

Contributing

Submit your fixes