Add VS Code debug launch

This commit is contained in:
Aoran Zeng 2025-06-18 22:21:33 +08:00
parent f312dd3b8d
commit 211e98cce1
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
3 changed files with 52 additions and 0 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@
!.vscode/settings.json
!.vscode/c_cpp_properties.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/README.md
*.o

34
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,34 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "开始Debug",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/chsrc-debug",
"args": [
"get",
"python"
],
"preLaunchTask": "构建 debug 版 chsrc",
"stopAtEntry": true,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
// "miDebuggerPath": "/path/to/gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}

17
.vscode/tasks.json vendored
View File

@ -17,6 +17,23 @@
},
"detail": "使用 just build 编译"
},
{
"type": "shell",
"label": "构建 debug 版 chsrc",
"command": "just",
"args": ["DEBUG=1", "build"],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "使用 just DEBUG=1 build 编译 debug 版"
},
{
"type": "shell",
"label": "测试 chsrc",