microsoft / microsoft/vscode-cmake-tools

Suggestion: add debugger "Compound" support

Open
#1,134 3 comments 1 reaction 0 assignees View on GitHub
enhancement Feature: debug/launch more votes needed stale-exempt
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

Hello everyone!

### Brief Issue Summary

I want to cover [compound system in vscode](https://code.visualstudio.com/docs/editor/debugging#_compound-launch-configurations) feature here.

To point to a binary generated by cmake, one can use
```
"program": "${command:cmake.launchTargetPath}",
```
as stated in the documentation.

However when debugging multiple binaries at the same time (e.g: client/server system), it is not possible to use *cmake.launchTargetPath* anymore because we need to select 2 targets to compile.

This is my current **launch.json**, with 2 cmake targets (respectively named **client** and **server**):

```
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch server",
"type": "cppdbg",
"request": "launch",
"program": "${config:cmake.buildDirectory}/server_debinfo",
.
.
.
]
},
{
"name": "(gdb) Launch client",
"type": "cppdbg",
"request": "launch",
"program": "${config:cmake.buildDirectory}/client_debinfo",
.
.
.
}
],
"compounds": [
{
"name": "Server/Client",
"configurations": ["(gdb) Launch client", "(gdb) Launch server"],
}
]
}
```
The problem is when the configuration is changed (for example, go for release) and the binaries names change, we have to go in launch.json and modify the paths to the binaries by hand each time.

### Suggestion:

A nice addition to this plugin would be to have a special variable allowing to point to the binary of a given target, e.g:
```
"program": "${command:cmake.launchTargetPath(client)}",
```
and
```
"program": "${command:cmake.launchTargetPath(server)}",
```

so compound can be used very easily.

### Other Notes/Information

Thank you so much for this wonderful plugin, it is really a daily pleasure to use it!

Contributor guide

Open the contributing guide

Research direction

Start by tracing the cmake.launchTargetPath command and how launch.json variables are resolved for CMake targets. Check how compound configurations invoke the two named debug configurations. Done means client and server configurations can resolve target-specific binary paths across build variants without manual launch.json edits.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.