2019-07-24 16:34:15 +08:00
|
|
|
# VSCode 调试脚本
|
|
|
|
|
2021-10-09 20:39:32 +08:00
|
|
|
VSCode 可以用来调试程序,通过修改 .vscode/launch.json 来支持各种调试需求。
|
2019-07-24 16:34:15 +08:00
|
|
|
|
2021-11-03 21:20:31 +08:00
|
|
|
## 1. 常用参数说明
|
|
|
|
|
|
|
|
### 1.1. 改变运行目录
|
|
|
|
|
|
|
|
在 "configurations" 中增加:
|
|
|
|
|
|
|
|
```json
|
|
|
|
"configurations": [
|
|
|
|
"cwd":"chdir path"
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
|
|
|
### 1.2. 增加调试参数
|
2019-07-24 16:34:15 +08:00
|
|
|
|
2021-10-09 20:39:32 +08:00
|
|
|
在 "configurations" 中增加:
|
2019-07-24 16:34:15 +08:00
|
|
|
|
|
|
|
```json
|
|
|
|
"configurations": [
|
|
|
|
"args":[
|
|
|
|
"arg1",
|
|
|
|
"...",
|
|
|
|
"argN"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
2021-10-09 20:39:32 +08:00
|
|
|
可在调试时增加程序入口参数。
|
|
|
|
|
|
|
|
## 2. ARM 交叉编译远程调试
|
|
|
|
|
|
|
|
在 "configurations" 中增加并修改:
|
|
|
|
|
|
|
|
```json
|
|
|
|
"program": "${YOUR/PROGRAM/FILE}",
|
|
|
|
"cwd": "${workspaceFolder}",
|
|
|
|
"linux": {
|
|
|
|
"miDebuggerPath": "${CROSS/GDB}",
|
|
|
|
},
|
|
|
|
"miDebuggerServerAddress": "${SERVER IP}:${SERVER PORT}"
|
|
|
|
```
|