microsoft / microsoft/vscode-cpptools

[Feature Request] Change Attach to Process to not require a program name by inferring it.

Open
#1,272 9 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

debugger Feature Request
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Currently, in order to attach to a process, I need to provide the following fields in my launch.json:

{
    "name" : "Attach (gdb)",
    "type" : "cppdbg",
    "request" : "attach"
    "program" : "${workspaceFolder}/path/to/program",
    "processId" : "${command:pickProcess}",
    "MIMode" : "gdb"
}

In my tests, it seems that the program field is validated (i.e. the executable exists, it is a valid executable), but it is completely ignored when debugging. I can set "program" = "/bin/bash" and attach to any process I want. But if I set "program" = "non existent file", I get a launch error that the program doesn't exist.

So why do I need to provide a path to the executable, when it is not needed?

Of course, it would be nice if ${command:pickProcess} would use this field to filter the processes, but it doesn't. Even then, it should be optional.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the cppdbg attach configuration and the launch.json validation path, then trace how processId ${command:pickProcess} and the program field are handled. Confirm whether attach can infer the executable without program, preserve validation for configurations that provide it, and verify that attaching works with only the process picker and MIMode settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.