Debug Guidelines
Issue reports
When reporting issues or finding bugs, we often need backtraces, debug logs, or both in order to track down the issue.
Graphics debugging
If your bug is related to a graphical issue -- e.g. mismatched colors, vertex explosions, flickering, etc. -- include graphics debugging logs in your issue report.
On desktop, open Settings > Debug and enable Enable Graphics Debugging. On Android, graphics-debugging controls are in the advanced settings. You may need to install the Vulkan validation layers:
- Windows: Install the Vulkan SDK.
- Linux: Install
vulkan-validation-layersor the equivalent package for your distribution.
Run the problematic game again with graphics debugging enabled. It can make the game run extremely slowly.
Debug logs
On desktop, open Settings > Debug > Open Log Location. On Android, use Share Debug Logs. Include the logs in bug reports, except for some UI-only issues; they are still helpful for those reports.
The desktop Global Log Filter accepts space-separated class:level rules. The available severity levels, from least to most severe, are Trace, Debug, Info, Warning, Error, and Critical. For example, *:Info Service.FS:Debug sets all classes to Info and the Service.FS class to Debug.
Trace log messages are compiled out unless the build defines _DEBUG. Other log levels are not restricted this way.
Debugging host code
When debugging host code, these commands let the debugger pass SIGSEGV through to the program instead of stopping on it:
gdb: handle SIGSEGV nostop pass
lldb: pro hand -p true -s false -n false SIGSEGV
Debugging guest code
GDB
Use an AArch64-capable GDB and connect it to the emulator's GDB stub. The stub is disabled by default; enable Enable GDB Stub in Settings > Debug. Its default port is 6543 (configurable in the same setting).
Alternatively, launch the SDL command-line build with -d to enable the stub. -d accepts an optional port directly appended to the option (for example, -d1234); without a port, it uses the configured port. The game can be specified with -g or as the positional filename:
./build/bin/yuzu-cmd -d -g "/path/to/game"
To attach from the machine running the emulator:
target remote localhost:6543
continue
If execution stops at a crash, use bt for a backtrace and layout asm to view assembly.
GDB cheatsheet
| Command | Purpose |
|---|---|
monitor help | Show available monitor commands. get info, get fastmem, and get mappings are available. |
detach | Detach from the remote target. |
c | Continue execution. |
p <expr> / p/x <expr> | Print an expression / print it in hexadecimal. |
bt | Print a backtrace. |
info threads / thread <number> | List threads / switch to a thread. |
layout asm | Display assembly in GDB's TUI. |
si | Step one assembly instruction. |
s / step | Step source code. |
display <expr> | Display an expression after each stop. |
n | Execute the next source line, stepping over calls. |
frame <number> | Switch to a frame from the backtrace. |
br <expr> | Set a breakpoint at an expression or symbol. |
delete | Delete all breakpoints. |
catch throw | Stop when a C++ exception is thrown. |
Expressions can be variable names, numbers, or pointer expressions such as *var and *(1 + var).
For more information, type info gdb or read the GDB man page.
RenderDoc
RenderDoc is a free, cross-platform graphics debugger with Vulkan support. Get it from renderdoc.org.
RenderDoc must be loaded before the emulator creates its Vulkan device. The reliable approach is to launch the emulator from RenderDoc. Check for Vulkan validation errors as well; RenderDoc can also help investigate them.
- Windows
- Linux
Use RenderDoc's UI to launch the desktop application executable, commonly build/bin/eglantine.exe. Captures are written to RenderDoc's configured capture directory; the application logs the default Windows location when RenderDoc is detected:
%LOCALAPPDATA%\Temp\RenderDoc
Use RenderDoc's UI to launch the desktop application executable, commonly build/bin/eglantine. Ensure the RenderDoc Vulkan layer is active for the launched process before it creates its Vulkan device.
Use RenderDoc's capture hotkey (usually F12) to capture a frame.
Eglantine capture hotkey
The Enable Renderdoc Hotkey debug setting enables Eglantine's own Toggle Renderdoc Capture hotkey. This does not load or unload RenderDoc; RenderDoc must already be attached. The first press starts a capture and the second ends it.
Black-screen debugging checklist
When debugging a black screen with RenderDoc, check that:
- Draw-call counts are plausible (not zero, or unexpectedly low).
- Vertex buffers are bound and vertex attribute sizes and offsets are correct.
- Push constants and descriptors contain the expected data, including model, view, and projection matrices.
- Pipeline state is appropriate: viewport and scissor dimensions, fill mode, culling, winding direction, blend state, and depth state.
- Swapchain images are bound when rendering to the swapchain, and the rendered image is the one being presented.
Alternatively, a RenderDoc Extension (Archive) automates many of these checks.