Debug linux

As always, there is a lot of ways to debug, here is how you can launch gdb with the qemu stub through libvirt and have debugging symbols in linux.

As always, you can find some documentation in the linux source tree: ~linux/Documentation/dev-tools/gdb-kernel-debugging.rst

The only thing missing from this is how to launch the qemu gdbstub through libvirt.

There is 2 ways to do that:

  • edit the vm file in order to add the qemu command line arguments (https://libvirt.org/drvqemu.html#qemucommand)

  • start the gdbstub from the monitor. In order to do that, you can use virsh:

    $ virsh qemu-monitor-command --hmp $vmname gdbserver