Skip to content

Support "program" for {"request": "attach"} instead of only "processId" #14046

@Som1Lse

Description

@Som1Lse

Feature Request

Currently

{
    "name": "(Windows) Launch",
    "type": "cppvsdbg",
    "request": "launch",
    "program": "myprogram.exe",
},

is used to launch (and attach to) a new process for debugging, while

{
    "name": "(Windows) Attach",
    "type": "cppvsdbg",
    "request": "attach",
    "processId": "${command:pickProcess}",
},

is used to attach to a process that is already running.

The former is great, the latter is incredibly inconvenient, since you often know exactly which process to attach to, but have to type it every single time. LLDB (vadimcn.vscode-lldb) supports

{
    "name": "(LLDB) Attach",
    "type": "lldb",
    "request": "attach",
    "program": "myprogram.exe",
},

which will simply look for a running program called myprogram.exe, and attach to it.


A related issue is #1904, where they asked to add "processName" to the schema. I think they were under the impression that cpptools supported (they probably found the name in something like this Stack Overflow question).

Also perhaps relevant is #1272, though that applies to GDB and specifically asks to make "program" optional.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions