Kernel debugging with QEMU: An overview of tools available

https://www.collabora.com/news-and-blog/blog/2017/03/13/kernel-debugging-with-qemu-overview-tools-available/

qemu:
INITRD=”-initrd /boot/initramfs-5.13.0-rc2.img”
KERNEL=”-kernel /home/ming.lin/build_upstream2/arch/x86/boot/bzImage”

sudo /home/ming.lin/qemu-vhost-nvme/x86_64-softmmu/qemu-system-x86_64 -nographic -enable-kvm -cpu host -smp 2 -m 2G \
-drive file=/home/ming.lin/image/vm01.sh.img \
-net nic,model=virtio,macaddr=52:54:00:12:34:58 -net tap,ifname=tap1,script=no,downscript=no \
$KERNEL $INITRD \
-append “root=/dev/mapper/cl-root console=ttyS0 console=tty1” \
-s

gdb:
gdb -ex ‘file vmlinux’ -ex ‘target remote localhost:1234’

Leave a Reply