{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version":"0.2.0", "configurations":[ { "name":"kernel debug", "type":"cppdbg", "request":"launch", "program": rust_shyper 目录, "cwd":"${workspaceFolder}", "MIMode":"gdb", "miDebuggerPath":aarch64-none-elf-gdb 目录, "miDebuggerServerAddress":"127.0.0.1:1234", } ] }
program 是要 debug 的可执行文件目录
miDebuggerPath 是 gdb 的目录
miDebuggerServerAddress 是调试程序服务器的网络地址
一定要注意 miDebuggerPath 的路径是交叉编译 gdb(aarch64-none-elf-gdb) 的位置,而不是普通 gdb 的位置 否则就会报错:truncated register 37 in remote g packet 是架构不支持的报错 详见:qemu-gdb debug
例如我的格式如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version":"0.2.0", "configurations":[ { "name":"kernel debug", "type":"cppdbg", "request":"launch", "program":"${workspaceFolder}/target/aarch64/release/rust_shyper", "cwd":"${workspaceFolder}", "MIMode":"gdb", "miDebuggerPath":"/usr/local/arm/gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf/bin/aarch64-none-elf-gdb", "miDebuggerServerAddress":"127.0.0.1:1234", } ] }
{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version":"2.0.0", "tasks":[ { "label":"qemu", "type":"shell", "command":"make debug", "presentation":{ "echo":true, "clear":true, "group":"qemu" }, "isBackground":true, "problemMatcher":[] } ] }
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version":"0.2.0", "configurations":[ { "name":"kernel debug", "type":"cppdbg", "request":"launch", "program":"${workspaceFolder}/target/aarch64/release/rust_shyper", "cwd":"${workspaceFolder}", "MIMode":"gdb", "miDebuggerPath":"/usr/local/arm/gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf/bin/aarch64-none-elf-gdb", "miDebuggerServerAddress":"127.0.0.1:1234", "preLaunchTask":"qemu" } ] }