อัปเดต 2563: มีปลั๊กอินvimspectorใหม่ที่ใช้โพรโทคอลตัวแก้จุดบกพร่อง
ติดตั้งปลั๊กอินhttps://github.com/puremourning/vimspector#installation
กำหนดค่า (เขียน.vimspector.json
)
คอมไพล์ด้วยสัญลักษณ์ดีบัก g++ cpp.cpp -ggdb -o cpp
กดF4
เพื่อเริ่มแก้ไขข้อบกพร่อง
- จดบันทึก
.vimspector.json
ไว้ในโฮมไดเร็กตอรี่ของฉัน (ทำงานในส่วนใดก็ได้)
{
"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"
}
}
} }