我们平时写程序的时候,需要 ./tinytest aaa这样的格式,但是vscode调试功能没有指定参数的功能,这里改一下配置就好了。
.vscode / launch.json
{
"version": "2.0.0",
"configurations": [
{
"name": "(gdb) 启动",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/tinytest",
"args": ["${workspaceFolder}/aa.tiny"],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "将反汇编风格设置为 Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}
program是需要运行的程序,args是输入的参数。
然后按F5就可以启动调试了。