-
-
[原创]使用qemu和vs code调试linux 0.11
-
发表于: 2025-9-11 07:52 483
-
前言
在上一篇文章
1 | https://bbs.kanxue.com/post-update-1816593.htm |
中介绍了在ubuntu24上编译和调试qemu 0.10.6,本文介绍如何使用这个qemu和vs code配合来调试linux0.11。
linux 0.11下载
1 | https://github.com/yuan-xy/Linux-0.11 |
修改Makefile
1 2 3 4 5 6 | start: @qemu -m 16M -boot a -fda Image -hda $(HDA_IMG)debug: @echo $(OS) @qemu -m 16M -boot a -fda Image -hda $(HDA_IMG) -s -S |
需要注意的是在编译完qemu 0.10.6后一定要
1 | make install |
不然会找不到qemu。这里使用的是qemu实际是qemu-system-i386。使用qemu-system-x86_64,vs code调试会出错。
启动qemu
在Linux-0.11-master目录下执行
1 | make |
编译完成后
1 | make debug |
启动qemu
配置vs code
使用vs code,ssh登录ubuntu后,打开Linux-0.11-master目录,新建.vscode/launch.json
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | { "version": "0.2.0", "configurations": [ { "name": "(gdb) 附加", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/tools/system", "MIMode": "gdb", "externalConsole": false, "stopAtEntry": false, "cwd":"${workspaceFolder}/tools/", "miDebuggerPath": "/usr/bin/gdb", "miDebuggerServerAddress": "127.0.0.1:1234", "setupCommands": [ { "description": "为 gdb 启用整齐打印", "text": "-enable-pretty-printing", "ignoreFailures": true }, { "description": "将反汇编风格设置为 Intel", "text": "-gdb-set disassembly-flavor intel", "ignoreFailures": true } ] }, ]} |
在main函数上打上断点,F5就可以自由调试了。
[培训]Windows内核深度攻防:从Hook技术到Rootkit实战!
最后于 2025-9-11 07:53
被zhzhz编辑
,原因:
赞赏
他的文章
赞赏
雪币:
留言: