I am trying to pass command line arguments to the gdb in vscode. Here is my launch.js config.
{
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/main",
"args": ["1"],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "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
}
]
}
]
}
Here is the file and folder structure.
Here is the simple sanity check code
#include<stdio.h>
int main(int argc, char* argv[])
{
printf("argc == %d\n", argc);
return 0;
}
Its output is
argc == 1
I am not able to capture argument. Please help.