qemu windows系统调试方式

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 了在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值