Debug Xv6 Kernel with GDB, QEMU and VScode
作者:互联网
Debug Xv6 Kernel with GDB, QEMU and VScode
The launch.json
is as follows:
{
"version": "0.2.0",
"configurations": [
{
"name": "C/C++: gcc 生成和调试活动文件",
"type": "cppdbg",
"request": "launch",
"miDebuggerPath": "/usr/bin/gdb-multiarch",
"miDebuggerServerAddress": "127.0.0.1:25000",
"program": "/root/xv6-labs-2021/kernel/kernel",
"args": [],
"stopAtEntry": false,
"cwd": "/root/xv6-labs-2021",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "将反汇编风格设置为 Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
},
],
}
]
}
- Run
make CPUS=1 qemu-gdb
in a seperate shell terminal. - Modify
.gdbinit
generated in the xv6 root directory. Comment outtarget remote 127.0.0.1:25000
. Remaining contents are
set confirm off
set architecture riscv:rv64
symbol-file kernel/kernel
set disassemble-next-line auto
set riscv use-compressed-breakpoints yes
- Press
F5
in vscode andenjoydebugging!
标签:Kernel,set,kernel,VScode,text,Xv6,gdb,xv6,root 来源: https://www.cnblogs.com/linfengshu/p/16380103.html