win7内核调试
被调试机启动命令
qemu-system-x86_64 -enable-kvm -smp 4 -drive file=win7.img, -m 4G -vga virtio -display egl-headless -machine usb=on -device usb-tablet -spice port=6688,addr=192.168.1.26,disable-ticketing -soundhw all -name win7 -chardev socket,id=charserial0,host=192.168.1.26,port=2449 -device isa-serial,chardev=charserial0,id=serial0
-chardev socket,id=charserial0,host=192.168.1.26,port=2449 -device isa-serial,chardev=charserial0,id=serial0
host是服务器ip, port是随意指定的
调试机启动命令
qemu-system-x86_64 -enable-kvm -smp 4 -drive file=win10.qcow2, -m 4G -vga virtio -display egl-headless -machine usb=on -device usb-tablet -spice port=6678,addr=192.168.1.26,disable-ticketing -soundhw all -name win10-debug -chardev socket,id=charserial0,host=0.0.0.0,port=2449,server,nowait -device isa-serial,chardev=charserial0,id=serial0
-chardev socket,id=charserial0,host=0.0.0.0,port=2449,server,nowait -device isa-serial,chardev=charserial0,id=serial0
调试机和被调试机的port要相同
被调试机系统配置
系统内开启串口调试
调试机配置
使用windbg连接
win10内核调试
在虚拟机里开启网络调试
bcdedit /debug on
bcdedit /dbgsettings net hostip:192.168.1.5 key:1.2.3.4 port:50009
hostip 是调试机的IP
在调试机里连接虚拟机
设置port 和key
远程调试用户程序
虚机启动命令添加网卡
-device e1000,netdev=nic0,mac=00:16:3e:0c:12:10 -netdev user,id=nic0,hostfwd=tcp::35112-:5009
其中35112是服务器端口, 5009是虚拟机内部端口
虚拟机内部开启 visual studio的remote debugger
调试机用vistual studio远程连接就可以了,连接后就能选择程序attach 了