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
- Debug Build
- RelWithDebInfo
- Release Build
Build with debug symbols and assertions enabled:Benefits:
- Full debug symbols
- Assertions enabled
- No optimization (easier to step through)
- Better stack traces
- 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.F5: Start/continue debuggingF9: Toggle breakpointF10: Step overF11: Step intoShift+F11: Step out
Visual Studio Code
- launch.json
- tasks.json
Create
.vscode/launch.json:GDB (Linux)
LLDB (macOS)
Logging and Diagnostics
Log Levels
Dolphin uses different log levels for diagnostic output:VIDEO: Video backendAUDIO: Audio processingCORE: Core emulationBOOT: Boot processPOWERPC: PowerPC CPUIOS: IOS emulationDSP: DSP emulation
Viewing Logs
- GUI
- Console
- Log File
In Dolphin’s UI:
- View → Show Log
- View → Show Log Configuration
- Enable desired log types and levels
Adding Debug Logging
When debugging issues, add temporary logging:Message Handlers
Custom Assertions
Dolphin uses a custom message handler for assertions and errors: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-emuthengdb 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
- AddressSanitizer
- Valgrind
- Memory Debugger
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
- 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:- View → Code: Open the code debugger
- Set breakpoints on PowerPC addresses
- Step through emulated code instruction by instruction
- View registers, memory, and call stack
Memory Breakpoints
Break when emulated code accesses specific memory:- View → Memory: Open memory viewer
- Right-click on address → Add Breakpoint
- Choose read, write, or read/write breakpoint
Register Tracking
Monitor PowerPC register changes:- View → Registers: Open register window
- Watch values change as code executes
- 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
Enable additional warnings:Getting Help
If you’re stuck debugging an issue:- Search existing issues: Check GitHub for similar problems
- Ask on IRC:
#dolphin-emu @ irc.libera.chat - 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