Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 99544

How to pass command-line arguments to debugger using VSCode?

$
0
0

I'm using VSCode on Linux and I've came up with a the following launch configuration in my attempt to fire the VSCode debugger, which, in turn, would rely on gdb:

{
    "version": "0.2.0",
    "configurations": [
    {
        "name": "(gdb) Launch",
        "type": "cppdbg",
        "request": "launch",
        "program": "${fileDirname}/${fileBasenameNoExtension}",
        "args": ["a", "b", "c", "d", "e"],
        "stopAtEntry": false,
        "cwd": "${fileDirname}",
        "environment": [],
        "externalConsole": false,
        "MIMode": "gdb",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ],
        "preLaunchTask": "make project"
    }]

}

Here, using the args attribute I'd like to pass 5 arguments to the process I'm debugging, namely: "a", "b", "c", "d", "e".

However, when I run the debugger, the argc value is correctly set to 6, but the values themselves, stored by argv are not present.

enter image description here


Viewing all articles
Browse latest Browse all 99544

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>