【发布时间】:2019-12-07 05:04:14
【问题描述】:
我正在按照本教程在 Ubuntu18.04 http://www.jamesmolloy.co.uk/tutorial_html/ 下设置一个微型操作系统。
到目前为止,我能够在 QEMU 中编译和运行微型内核。并且还能够使用命令行 gdb 连接 gdb-server。
qemu -S -s -fda floppy.img -boot a &
sleep 1
cgdb -x scripts/gdbinit
但我想使用 Vscode gdb GUI 而不是命令行 gdb,所以我搜索这个页面https://wiki.osdev.org/User:TheCool1Kevin/VSCode_Debug 来设置 json 文件。 这是我的 launch.json 文件:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch with GDB",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/boot/boot.o",
"cwd": "${workspaceRoot}",
"args": [],
"targetArchitecture": "x86",
"MIMode": "gdb",
"miDebuggerPath": "",
"miDebuggerArgs": "",
"customLaunchSetupCommands": [],
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"text": "file ${workspaceRoot}/cmy_kernel",
"description": "Load binary."
},
{
"text": "target remote :1234",
"description": "connect the port"
},
{
"text": "break kern_entry",
"description": "Break on exception handler."
},
],
"preLaunchTask": "Launch QEMU"
}
]
}
而我的 task.json 是
{
"version": "2.0.0",
"tasks": [
{
"label": "Launch QEMU",
"type": "shell",
"windows": {
"command": ""
},
"linux": {
"command": "qemu -S -s -fda floppy.img -boot a &sleep 1 &"
}
}
]
}
我希望能够调试VScode下的代码,但是当我开始调试时,VScode显示无法连接服务器:1234超时。
我不知道如何修改文件。任何使用扩展的建议都值得赞赏。
【问题讨论】:
标签: gdb qemu vscode-debugger