3

right now my launch.json file for debugging looks like this

{
   // ${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
            }
        ]
    }
]}

but the things is that I need to manually update the processid every time, is that possible that for the "processId", I can invoke some kind of script and return a pid in programmatic manner? ex. "processId": ${shell_script: get_pid}

4

1 回答 1

3

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

于 2019-06-28T19:01:50.783 回答