{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Attach",
            "type": "cppdbg",
            "request": "attach",
            "program": "${cwd}/client/proxmark3",
            //"processId": "${command:pickProcess}",
            "processId": "${input:ProcessID}",
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "windows": {
                "processId": "${input:ProcessIDWindows}",
                "miDebuggerPath": "${workspaceFolder}/../../msys2/mingw64/bin/gdb.exe",
                "externalConsole": true,//for ProxSpace externalConsole=true is required, because the internal cosole stops updating after a while
                "environment": [{
                    "name": "PATH","value": "${workspaceFolder}/../../msys2/mingw64/bin;${workspaceFolder}/../../msys2/usr/local/bin;${workspaceFolder}/../../msys2/usr/bin;${workspaceFolder}/../../msys2/bin"
                }]
            }
        },{
            "name": "(gdb) Build & Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${cwd}/client/proxmark3",
            "args": ["/dev/ttyACM0"], 
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "client: Debug: clean & make",
            "miDebuggerPath": "/usr/bin/gdb",
            "windows": {
                "args": ["COM5"],
                "miDebuggerPath": "${workspaceFolder}/../../msys2/mingw64/bin/gdb.exe",
                "externalConsole": true,//for ProxSpace externalConsole=true is required, because the internal cosole stops updating after a while
                "environment": [{
                    "name": "PATH","value": "${workspaceFolder}/../../msys2/mingw64/bin;${workspaceFolder}/../../msys2/usr/local/bin;${workspaceFolder}/../../msys2/usr/bin;${workspaceFolder}/../../msys2/bin"
                }]
            }
        }
    ],
    "inputs": [
        {
            // Using Extension "Tasks Shell Input" https://marketplace.visualstudio.com/items?itemName=augustocdias.tasks-shell-input
            "id": "ProcessID",
            "type": "command",
            "command": "shellCommand.execute",
            "args": {
                "command": "pgrep -n proxmark3",
            }
            
        },{
            "id": "ProcessIDWindows",
            "type": "command",
            "command": "shellCommand.execute",
            "args": {
                "command": "${workspaceFolder}/../../runme64.bat -c \"cat /proc/$(pgrep -n proxmark3)/winpid\"",
            }
            
        }
    ]
}