Skip to content

Commit 981a191

Browse files
authored
优化 VS Code DEBUG 设置 (#270)
1 parent fd21308 commit 981a191

File tree

2 files changed

+82
-7
lines changed

2 files changed

+82
-7
lines changed

.vscode/launch.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
"program": "${workspaceFolder}/chsrc-debug",
99
"args": [
1010
"get",
11-
"python"
11+
"nodejs"
1212
],
1313
"preLaunchTask": "构建 debug 版 chsrc",
1414
"stopAtEntry": true,
1515
"cwd": "${workspaceFolder}",
1616
"environment": [],
17-
"externalConsole": false,
17+
// 如果你认为使用弹出窗口难以调试,可尝试设置为false
18+
"externalConsole": true,
19+
// lldb 等请自行设置,不作额外说明
1820
"MIMode": "gdb",
1921
// "miDebuggerPath": "/path/to/gdb",
2022
"setupCommands": [
@@ -28,7 +30,8 @@
2830
"text": "-gdb-set disassembly-flavor intel",
2931
"ignoreFailures": true
3032
}
31-
]
33+
],
34+
"postDebugTask": "停止 debug 程序"
3235
},
3336

3437
{
@@ -58,4 +61,4 @@
5861
]
5962
}
6063
]
61-
}
64+
}

.vscode/tasks.json

Lines changed: 75 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"kind": "build",
1818
"isDefault": true
1919
},
20-
"detail": "使用 just build 编译"
20+
"dependsOn": "停止程序",
21+
"detail": "先停止原有程序,然后使用 just build 编译"
2122
},
2223
{
2324
"type": "shell",
@@ -36,7 +37,6 @@
3637
"kind": "build",
3738
"isDefault": false
3839
},
39-
"detail": "使用 just build-in-debug-mode 编译 debug 版"
4040
},
4141
{
4242
"type": "shell",
@@ -94,7 +94,79 @@
9494
"isDefault": false
9595
},
9696
"detail": "使用 just test-xy 测试 xy.h"
97+
},
98+
{
99+
"type": "shell",
100+
"label": "停止 debug 程序",
101+
"windows": {
102+
"command": "powershell",
103+
"args": [
104+
"-c",
105+
"Get-Process -Name \"chsrc-debug\" -ErrorAction SilentlyContinue | Stop-Process -Force;",
106+
"Get-Process -Name \"gdb\" -ErrorAction SilentlyContinue | Stop-Process -Force;",
107+
"Get-Process -Name \"WindowsDebugLauncher\" -ErrorAction SilentlyContinue | Stop-Process -Force;"
108+
]
109+
},
110+
"linux": {
111+
"command": "bash",
112+
"args": [
113+
"-c",
114+
"if pgrep -f chsrc-debug > /dev/null; then pkill -f chsrc-debug; fi"
115+
]
116+
},
117+
"osx": {
118+
"command": "bash",
119+
"args": [
120+
"-c",
121+
"if pgrep -f chsrc-debug > /dev/null; then pkill -f chsrc-debug; fi"
122+
]
123+
},
124+
"group": "build",
125+
"presentation": {
126+
"echo": true,
127+
"reveal": "silent",
128+
"focus": false,
129+
"panel": "shared",
130+
"showReuseMessage": true,
131+
"clear": false
132+
},
133+
"detail": "停止 debug 版本的 chsrc"
134+
},
135+
{
136+
"type": "shell",
137+
"label": "停止程序",
138+
"windows": {
139+
"command": "powershell",
140+
"args": [
141+
"-c",
142+
"Get-Process -Name \"chsrc\" -ErrorAction SilentlyContinue | Stop-Process -Force;"
143+
]
144+
},
145+
"linux": {
146+
"command": "bash",
147+
"args": [
148+
"-c",
149+
"if pgrep -f chsrc > /dev/null; then pkill -f chsrc; fi"
150+
]
151+
},
152+
"osx": {
153+
"command": "bash",
154+
"args": [
155+
"-c",
156+
"if pgrep -f chsrc > /dev/null; then pkill -f chsrc; fi"
157+
]
158+
},
159+
"group": "build",
160+
"presentation": {
161+
"echo": true,
162+
"reveal": "always",
163+
"focus": false,
164+
"panel": "shared",
165+
"showReuseMessage": true,
166+
"clear": false
167+
},
168+
"detail": "跨平台停止 chsrc"
97169
}
98170
],
99171
"version": "2.0.0"
100-
}
172+
}

0 commit comments

Comments
 (0)