GDB Debugging
Kernel Debugging
Debug the Redox kernel using GDB with QEMU’s remote debugging protocol.Start QEMU with GDB support
In one terminal, start QEMU with GDB enabled:
This starts QEMU with the flags
-d cpu_reset -s -S, which:- Logs CPU resets
- Opens a GDB server on port 1234
- Waits for GDB to connect before starting
Userspace Debugging
- GDB Direct (Not Recommended)
- GDB with gdbserver (Recommended)
Advanced GDB Debugging
Debug with gdbgui (Interactive Web Interface)
Debug with gdbgui (Interactive Web Interface)
Enable debug symbols and use gdbgui for a web-based debugging interface:Open http://localhost:5000/dashboard in your browser.
Launch gdbgui
Multi-arch Debugging
Multi-arch Debugging
For debugging architectures different from your host:This is set automatically in the Makefile:
QEMU Debugging Options
Serial Output and Debugging Console
- Serial Console (Default)
- Debug Console Only
- Serial with Logfile
By default, serial output is enabled:This uses:
Graphics and Display Options
CPU and Performance Options
- KVM Acceleration
- CPU Configuration
- IOMMU
Enable KVM for faster execution (default on matching host arch):Disable KVM:
On Linux with matching architecture, this uses
-enable-kvm -cpu host.
On macOS with ARM, this uses -accel hvf -cpu max.Disk and Storage Options
Network Debugging
- Network Packet Capture
- Port Forwarding
- Network Adapters
- Bridge Networking
By default, network traffic is captured to a pcap file:This creates Or directly:
build/<arch>/<config>/network.pcap.View with Wireshark:Logging and Error Collection
Capture All Output
Capture both stdout and stderr to a log file:Build System Logging
Enable verbose logging during builds:Architecture-Specific Debugging
- x86_64
- i586
- aarch64
- riscv64gc
Default configuration:Debug exit codes (for redoxer):Uses
-device isa-debug-exit (exit code: 51 = success, 53 = failure).Common Debugging Scenarios
Debugging Boot Issues
Debugging Boot Issues
Debugging Network Issues
Debugging Network Issues
Debugging Driver Issues
Debugging Driver Issues
Update initfs
See How to update initfs.
Performance Profiling
QEMU Performance Options
Benchmarking
Run benchmarks on Redox:tests.toml configuration includes:
redox-testspackagebenchmarkspackage
Troubleshooting
GDB Won't Connect
GDB Won't Connect
Serial Output Not Showing
Serial Output Not Showing
- Try
serial=yesexplicitly - Check if output is going to a logfile
- Verify QEMU version compatibility
QEMU Performance Issues
QEMU Performance Issues
- Enable KVM:
make qemu kvm=yes - Reduce SMP:
make qemu QEMU_SMP=1 - Use lighter GPU:
make qemu gpu=no - Disable audio:
make qemu audio=no
Additional Resources
Developer FAQ
Common debugging questions
Build System Reference
Complete build system documentation
Testing Guide
Learn how to test your changes
Kernel Documentation
Kernel API documentation