Skip to content

Dynamically choose PID to attach #402

Open

Description

@v-lopez

When attaching to an application, having to set manually the PID on the launch.json breaks quite a bit the flow.

Would it be possible to use the ${command:pickProcess} as is done on the default C++ debugger?

Activity

  1. GitMensch commented on Aug 31, 2023

    @GitMensch
    Collaborator

    Ideally: also provide an optional filter to the command (that would allow to specify [part of] the application name or even better [part of] the cmd [= arguments passed] along with the command / user) that would make it much easier to choose the right process, not "one of the three interesting of the thousand processes running on that server".

  2. Hovhannes-M commented on Jan 31, 2024

    @Hovhannes-M
    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "COBOL debugger attach",
                "type": "gdb",
                "request": "attach",
                "target": "${input:pid}",
                "valuesFormatting": "parseText",
                "showDevDebugOutput": false,
                "printCalls": false,
                "debugger_args": []
            }
        ],
        "inputs": [
            {
                "id": "pid",
                "type": "promptString",
                "description": "PID to attach"
            }
        ]
    }
  3. melzareix commented on Aug 26, 2025

    @melzareix

    With this extension i am able to replicate it using pgrep https://marketplace.visualstudio.com/items?itemName=augustocdias.tasks-shell-input

      "inputs": [
            {
                "id": "findpid",
                "type": "command",
                "command": "shellCommand.execute",
                "args": {
                    "command": "pgrep process_name",
                    "description": "Select your PID",
                    "useFirstResult": true,
                }
            }
        ],
        "configurations": [
            {
                "type": "gdb",
                "request": "attach",
                "name": "Attach to PID",
                "target": "${input:findpid}",
    ....
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions