launch.json中的VSCode动态processid

时间:2018-06-14 13:34:41

标签: visual-studio-code vscode-debugger

现在我用于调试的launch.json文件看起来像这样

{
   // ${command:pickProcess}
   "version": "0.2.0",
   "configurations": 
    [{ 
        "name": "(gdb) Attach",
        "type": "cppdbg",
        "request": "attach",
        "program": "${workspaceFolder}/devel/lib/beginner_tutorials/talker",
        "processId": "619",
        "MIMode": "gdb",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ]
    }
]}

但问题是我每次都需要手动更新processid,对于" processId",我可以调用某种脚本并以编程方式返回pid吗? 恩。      " processId":$ {shell_script:get_pid}

1 个答案:

答案 0 :(得分:1)

您可以使用"processId": "${command:pickRemoteProcess}",打开一个流程选择器,以便选择它。