Skip to main content

Overview

Debugging Dolphin requires a combination of traditional debugging tools, emulator-specific features, and knowledge of GameCube/Wii hardware. This guide covers the essential debugging workflows.

Development Builds

Debug vs Release Builds

Build with debug symbols and assertions enabled:
Benefits:
  • Full debug symbols
  • Assertions enabled
  • No optimization (easier to step through)
  • Better stack traces
Drawbacks:
  • Significantly slower execution
  • Larger binary size
For most debugging work, use Debug builds. For performance profiling, use RelWithDebInfo.

Debugger Setup

Visual Studio (Windows)

1

Open solution

Open the generated Dolphin.sln in Visual Studio after running CMake.
2

Set startup project

Right-click the dolphin-emu project and select “Set as Startup Project”.
3

Configure debugging

Set breakpoints by clicking in the left margin of the code editor.
4

Start debugging

Press F5 to start debugging, or Ctrl+F5 to run without debugging.
Useful shortcuts:
  • F5: Start/continue debugging
  • F9: Toggle breakpoint
  • F10: Step over
  • F11: Step into
  • Shift+F11: Step out

Visual Studio Code

Create .vscode/launch.json:

GDB (Linux)

Enable pretty printing for STL containers:

LLDB (macOS)

Logging and Diagnostics

Log Levels

Dolphin uses different log levels for diagnostic output:
Log types (first parameter):
  • VIDEO: Video backend
  • AUDIO: Audio processing
  • CORE: Core emulation
  • BOOT: Boot process
  • POWERPC: PowerPC CPU
  • IOS: IOS emulation
  • DSP: DSP emulation

Viewing Logs

In Dolphin’s UI:
  1. View → Show Log
  2. View → Show Log Configuration
  3. Enable desired log types and levels

Adding Debug Logging

When debugging issues, add temporary logging:
Remove or disable verbose debug logging before submitting pull requests.

Message Handlers

Custom Assertions

Dolphin uses a custom message handler for assertions and errors:
This prevents the emulator from breaking on assertions during testing.

Common Debugging Scenarios

Debugging Crashes

1

Get stack trace

When Dolphin crashes, capture the stack trace:
  • Windows: Check Event Viewer or use Visual Studio debugger
  • Linux: ulimit -c unlimited && ./dolphin-emu then gdb dolphin-emu core
  • macOS: Check Console.app for crash reports
2

Enable core dumps

Configure system to save core dumps:
3

Analyze with debugger

Load core dump:

Debugging JIT Code

For JIT compiler issues:
Use the “Enable Debugging UI” option in Dolphin settings to access JIT-related debugging features.

Memory Issues

Build with ASan to detect memory errors:

Performance Issues

1

Profile with built-in tools

Enable performance statistics:
  • View → Show Performance Monitor
  • View → Show FPS counter
2

Use external profilers

Linux:
Windows:
  • Visual Studio Profiler
  • Intel VTune
macOS:
  • Instruments (Xcode)
3

Identify bottlenecks

Look for hot paths in profiler output and optimize accordingly.

Emulator-Specific Debugging

Code Breakpoints

Dolphin includes a debugger for the emulated PowerPC CPU:
  1. View → Code: Open the code debugger
  2. Set breakpoints on PowerPC addresses
  3. Step through emulated code instruction by instruction
  4. View registers, memory, and call stack

Memory Breakpoints

Break when emulated code accesses specific memory:
  1. View → Memory: Open memory viewer
  2. Right-click on address → Add Breakpoint
  3. Choose read, write, or read/write breakpoint

Register Tracking

Monitor PowerPC register changes:
  1. View → Registers: Open register window
  2. Watch values change as code executes
  3. Edit registers to test different scenarios

Unit Test Debugging

When debugging failing tests:
See the Testing guide for more information on running and writing tests.

Best Practices

1

Use assertions

Add assertions to catch invalid states early:
2

Validate assumptions

Check preconditions and postconditions:
3

Use descriptive variable names

Makes debugging easier when inspecting variables:
4

Isolate the problem

Narrow down the issue:
  • Binary search commits with git bisect
  • Disable features to identify culprit
  • Create minimal reproduction case
5

Document findings

Keep notes about:
  • What you tried
  • What worked/didn’t work
  • Root cause analysis

Compiler Warnings

Always fix compiler warnings. They often indicate real bugs.
Enable additional warnings:
Treat warnings as errors during development:

Getting Help

If you’re stuck debugging an issue:
  1. Search existing issues: Check GitHub for similar problems
  2. Ask on IRC: #dolphin-emu @ irc.libera.chat
  3. Create detailed report: Include:
    • Steps to reproduce
    • Expected vs actual behavior
    • Stack traces or logs
    • Build configuration
    • System information

Next Steps

Code Style

Review coding standards and formatting

Testing

Learn about unit testing practices