microsoft / vscode-cmake-tools

CMake integration in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vector-of-bool.cmake-tools
MIT License
1.48k stars 454 forks source link

Suggestion: add debugger "Compound" support #1134

Open lp35 opened 4 years ago

lp35 commented 4 years ago

Hello everyone!

Brief Issue Summary

I want to cover compound system in vscode 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!

guochengli commented 4 years ago

@lp35 There might be a bug with the above config: When starting to debug the compound, there would be only the terminal of the compound shown. There should be two since two programs are running.

VS Code version: Code 1.46.0 (a5d1cc28bb5da32ec67e86cc50f84c67cc690321, 2020-06-10T09:03:20.462Z) OS version: Windows_NT x64 10.0.18363 Remote OS version: Linux x64 4.15.0-1050-oem

System Info |Item|Value| |---|---| |CPUs|Intel(R) Xeon(R) Silver 4110 CPU @ 2.10GHz (16 x 2095)| |GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|31.66GB (21.38GB free)| |Process Argv|| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|SSH: hkdev01| |OS|Linux x64 4.15.0-1050-oem| |CPUs|Intel(R) Xeon(R) Silver 4112 CPU @ 2.60GHz (16 x 2900)| |Memory (System)|62.55GB (2.37GB free)| |VM|0%|
Extensions (5) Extension|Author (truncated)|Version ---|---|--- remote-ssh|ms-|0.48.0 remote-ssh-edit|ms-|0.48.0 remote-wsl|ms-|0.44.2 cmake-tools|ms-|1.4.0 cpptools|ms-|0.28.2
lp35 commented 4 years ago

Yes it is a bug as the behaviour is random. Are you just reporting or are you able to do something about it?

Cheers

github-actions[bot] commented 1 year ago

This issue is now marked as 'stale-old' due to there being no activity on it for the past 720 days. Unless the 'stale-old' label is removed or the issue is commented on, this will be remain open for at least 14 days and then it may be closed. If you would like to make this issue exempt from getting stale, please add the 'stale-exempt' label.