cloud-hypervisor/docs/gdb.md
Alyssa Ross dee7993538 docs: fix gdb path option name
Fixes: fa22cb0be ("docs: update command line options to use clap")
Signed-off-by: Alyssa Ross <hi@alyssa.is>
2026-01-15 18:55:36 +00:00

1.3 KiB

GDB Support

This feature allows remote guest debugging using GDB. Note that this feature is supported on x86_64 and aarch64 with KVM.

To enable debugging with GDB, build with the guest_debug feature enabled:

cargo build --features guest_debug

To use the --gdb option, specify the Unix Domain Socket with path that Cloud Hypervisor will use to communicate with the host's GDB:

./cloud-hypervisor \
    --kernel hypervisor-fw \
    --disk path=bionic-server-cloudimg-amd64.raw \
    --cpus boot=1 \
    --memory size=1024M \
    --net "tap=,mac=,ip=,mask=" \
    --console off \
    --serial tty \
    --gdb path=/tmp/ch-gdb-sock

Cloud Hypervisor will listen for GDB on the host side before starting the guest. On the host side, connect to the GDB remote server as follows:

gdb -q
(gdb) target remote /tmp/ch-gdb-sock
Remote debugging using /tmp/ch-gdb-sock
warning: No executable has been specified, and target does not support
determining executable automatically. Try using the "file" command.
0x000000000011217e in ?? ()

You can set up to four hardware breakpoints using the x86 debug register:

(gdb) hb *0x1121b7
Hardware assisted breakpoint 1 at 0x1121b7
(gdb) c
Continuing.

Breakpoint 1, 0x00000000001121b7 in ?? ()
(gdb)