Debugging with gdb
gdb is a debugger that allows inspecting programs while they're running, tracing execution, placing breakpoints, stepping through code, and editing memory. If you've used the Project64 debugger, it's like that but much better (sorry shygoo).
To use gdb, you'll need gdb-multiarch, a gdb server and a gdb client.
Compile with debug symbols
./configure --debug
ninja
Installing gdb-multiarch
- Ubuntu and derivatives:
sudo apt install -y gdb-multiarch
- macOS: run Ubuntu in a container and install it there
gdb server
The ares emulator has had gdb support for N64 since v134.
To enable ares' gdb server, go to Settings > Debug and check Enabled.
The following message will appear at the bottom of the ares window: GDB pending ([::1]:9123)
gdb client
Make sure the gdb server is running. Then:
- VSCode: Open a C file and press F5. More...
- Terminal: Start
gdb-multiarch
and entertarget remote [::1]:9123
. More...
Overlays
TODO: migrate overlay support to dx
This page was adapted from Dragorn421's oot gdb tutorial.