2020年更新:有一个使用调试适配器协议的新插件vimspector
安装插件https://github.com/puremourning/vimspector#installation
配置(写.vimspector.json
)
用调试符号编译 g++ cpp.cpp -ggdb -o cpp
按F4
开始调试
- 注意我
.vimspector.json
的主目录中的my(因此可以在任何子目录中工作)
{
"configurations": {
"Python - Launch": {
"adapter": "vscode-python",
"configuration": {
"name": "Python: Launch current file",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"stopAtEntry": true,
"console": "externalTerminal",
"debugOptions": [],
"cwd": "${cwd}",
"program": "${file}"
}
},
"Perl - Launch": {
"adapter": "vscode-perl-debug",
"configuration": {
"name": "Perl: Launch current file",
"type": "perl",
"request": "launch",
"exec": "/usr/bin/env perl",
"execArgs": [],
"stopOnEntry": true,
"stopAtEntry": true,
"console": "externalTerminal",
"sessions": "single",
"debugOptions": [],
"cwd": "${cwd}",
"program": "${file}"
}
},
"C - Launch": {
"adapter": "vscode-cpptools",
"configuration": {
"name": "Cpp: Launch current file",
"type": "cppdbg",
"request": "launch",
"externalConsole": true,
"logging": {
"engineLogging": true
},
"stopOnEntry": true,
"stopAtEntry": true,
"debugOptions": [],
"MIMode": "gdb",
"cwd": "${cwd}",
"program": "${fileDirname}/${fileBasenameNoExtension}"
}
},
"Java - Launch": {
"adapter": "vscode-java",
"configuration": {
"name": "Java: Launch current file",
"request": "launch",
"mainClass": "com.vimspector.test.TestApplication",
"sourcePaths": [ "${workspaceRoot}/src/main/java" ],
"classPaths": [ "${workspaceRoot}/target/classes" ],
"args": "hello world!",
"stopOnEntry": true,
"console": "integratedTerminal"
}
}
} }