Hi Giant VM team! Has anyone had success using the QEMU gdbstub with GiantVM? I see that gdb works with a normal QEMU instance but not when using multiple instances. The problem I am having is gdb hangs when trying to single step a GiantVM's kernel. Here is an example:
This works:
[term1] $ cat run-qemu.sh
#!/bin/bash
{$BUILD}/${BRANCH}/x86_64-softmmu/qemu-system-x86_64 \
-m 2048 -nographic \
-hda ubuntu-l2.img \
-cpu host -machine kernel-irqchip=off -enable-kvm \
-kernel vmlinuz-4.8.0-22-generic -initrd initrd.img-4.8.0-22-generic \
-machine kernel-irqchip=off -append "root=/dev/sda1 console=ttyS0 clocksource=hpet nokaslr init=/bin/bash" \
-netdev user,id=net0,hostfwd=tcp::2224-:22 -device e1000,netdev=net0 \
-smp 2 \
-gdb tcp::4010 -S
[term1] $ sudo ./run-qemu.sh
[term2] $ gdb -ex "target remote :4010"
[...]
Remote debugging using :4010
warning: No executable has been specified and target does not support
determining executable automatically. Try using the "file" command.
0x000000000000fff0 in ?? ()
(gdb) si
0x000000000000e05b in ?? ()
(gdb)
This does not work:
[term1] $ cat run-gdbstub-ap-2.sh
#!/bin/bash
{$BUILD}/${BRANCH}/x86_64-softmmu/qemu-system-x86_64 \
-m 2048 -nographic \
-hda ubuntu-l2.img \
-cpu host -machine kernel-irqchip=off -enable-kvm \
-kernel vmlinuz-4.8.0-22-generic -initrd initrd.img-4.8.0-22-generic \
-append "root=/dev/sda1 console=ttyS0 clocksource=tsc nokaslr init=/bin/bash" \
-netdev user,id=net0,hostfwd=tcp::2223-:22 -device e1000,netdev=net0 \
-smp 2 -local-cpu 1,start=1,iplist="127.0.0.1 127.0.0.1" \
-monitor telnet:127.0.0.1:4001,server,nowait \
-gdb tcp::4011 -S
[term1] $ sudo ./run-gdbstub-ap-2.sh
[term2] $ cat run-gdbstub-bsp-1.sh
#!/bin/bash
${BUILD}/${BRANCH}/x86_64-softmmu/qemu-system-x86_64 \
-m 2048 -nographic \
-hda ubuntu-l2.img \
-cpu host -machine kernel-irqchip=off -enable-kvm \
-kernel vmlinuz-4.8.0-22-generic -initrd initrd.img-4.8.0-22-generic \
-machine kernel-irqchip=off -append "root=/dev/sda1 console=ttyS0 clocksource=tsc nokaslr init=/bin/bash" \
-netdev user,id=net0,hostfwd=tcp::2224-:22 -device e1000,netdev=net0 \
-smp 2 -local-cpu 1,start=0,iplist="127.0.0.1 127.0.0.1" \
-gdb tcp::4010 -S
[term2] $ sudo ./run-gdbstub-bsp-1.sh
[term3] $ gdb -ex "target remote :4010"
[...]
]Remote debugging using :4010
warning: No executable has been specified and target does not support
determining executable automatically. Try using the "file" command.
0x000000000000fff0 in ?? ()
(gdb) si
<hangs here>
My next steps are to look closely at the QEMU code. But before I investigate, I wanted to ask if others had reproduced or solved this problem.
Hi Giant VM team! Has anyone had success using the QEMU gdbstub with GiantVM? I see that
gdbworks with a normal QEMU instance but not when using multiple instances. The problem I am having isgdbhangs when trying to single step a GiantVM's kernel. Here is an example:This works:
This does not work:
My next steps are to look closely at the QEMU code. But before I investigate, I wanted to ask if others had reproduced or solved this problem.