[Libguestfs] Debugging nested KVM guest (L2) booting with libguestfs/gdb

Kashyap Chamarthy kchamart at redhat.com
Thu Feb 13 08:13:52 UTC 2014


On Thu, Feb 13, 2014 at 12:08:37AM +0530, Kashyap Chamarthy wrote:
 
[. . .]

> 
> Try a couple more things
> ------------------------
> 
> - Run `qemu-sanity-check` in L1 -- Of course, this fails too.
> 
> - Invoke (from a different shell, as root) QEMU directly with gdb
>   debugging options -s -S with KVM on L1:
> 
>    $ qemu-system-x86_64 -s -S -nographic -nodefconfig \
>      -nodefaults -machine accel=kvm -m 4000 \
>      -drive file=/home/tuser1/vmimages/fedora-20.qcow2,if=ide,format=qcow2,cache=none \
>      -serial stdio

So,  using -serial mon:stdio like below, and using CTL+a to toggles
monitor and stdio (thanks to Amit Shah for the tip):

    $ qemu-system-x86_64 -s -S -nographic -nodefconfig   \
      -nodefaults -enable-kvm -machine accel=kvm -m 4000 \
      -drive file=/home/tuser1/vmimages/fedora-20.qcow2,format=qcow2,cache=none \
      -device virtio-serial -serial mon:stdio
    
    C-a h    print this help
    C-a x    exit emulator
    C-a s    save disk data back to file (if -snapshot)
    C-a t    toggle console timestamps
    C-a b    send break (magic sysrq)
    C-a c    switch between console and monitor
    C-a C-a  sends C-a
    QEMU 1.7.0 monitor - type 'help' for more information
    (qemu) 
    (qemu) gdbserver 
    Duplicate ID 'gdb' for chardev
    Could not open gdbserver on device 'tcp::1234'
    (qemu) 

Seems like out of the box, gdb debugging doesn't work? This[1] suggests
otherwise. The documentation here[2] seems to be sparse.


  [1] http://wiki.qemu.org/download/qemu-doc.html#gdb_005fusage
  [2] http://wiki.qemu.org/Documentation/Debugging

-- 
/kashyap




More information about the Libguestfs mailing list