Skip to main content
This guide covers debugging techniques and tools for Redox OS development, including GDB debugging, QEMU options, and network analysis.

GDB Debugging

Kernel Debugging

Debug the Redox kernel using GDB with QEMU’s remote debugging protocol.
1

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
2

Connect GDB

In another terminal, connect GDB to the kernel:
This runs:
3

Debug

Use standard GDB commands to debug:
Non-blocking GDB mode: Use gdb=nonblock to allow attaching GDB without blocking QEMU startup:

Userspace Debugging

Use gdbserver when possible! The userspace debugging target stops the entire VM, not just the application. Only use this when:
  • The application runs early during boot before the network stack starts
  • You need to debug the interaction between the application and kernel

Advanced GDB Debugging

Enable debug symbols and use gdbgui for a web-based debugging interface:
1

Build with debug symbols

Verify debug symbols:
2

Start QEMU with GDB

3

Launch gdbgui

Open http://localhost:5000/dashboard in your browser.
This is experimental and may not work if ARCH differs from the host architecture.
For debugging architectures different from your host:
This is set automatically in the Makefile:

QEMU Debugging Options

Serial Output and Debugging Console

By default, serial output is enabled:
This uses:

Graphics and Display Options

CPU and Performance Options

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

By default, network traffic is captured to a pcap file:
This creates build/<arch>/<config>/network.pcap.View with Wireshark:
Or directly:

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

Default configuration:
Debug exit codes (for redoxer):
Uses -device isa-debug-exit (exit code: 51 = success, 53 = failure).

Common Debugging Scenarios

1

Use serial console

2

Check bootloader

For UEFI boot issues, verify firmware path:
3

Try different boot methods

1

Enable packet capture

This creates build/network.pcap.
2

Analyze with Wireshark

3

Test connectivity

Use port forwarding to test services:
1

Build driver with debug symbols

2

Update initfs

3

Run with serial logging

4

Debug with GDB

1

Mount the filesystem

Inspect at build/<arch>/<config>/filesystem/.
2

Check disk image

3

Unmount when done

Performance Profiling

QEMU Performance Options

Benchmarking

Run benchmarks on Redox:
The tests.toml configuration includes:
  • redox-tests package
  • benchmarks package

Troubleshooting

1

Check QEMU is waiting

Ensure you see the GDB server message:
2

Verify port availability

3

Try manual connection

  • Try serial=yes explicitly
  • Check if output is going to a logfile
  • Verify QEMU version compatibility
  • 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