You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow custom debug adapter type in cmake.debugConfig (#4818)
* Initial plan
* feat: allow custom debug adapter type in cmake.debugConfig
When `type` is specified in `cmake.debugConfig`, automatic debugger
detection from the CMake cache is skipped. Instead, a minimal base
configuration is built from the target (program, cwd, name) and
the user's full configuration is overlaid. This enables using any
debug adapter (e.g., codelldb, lldb) with arbitrary properties.
The `CppDebugConfiguration` interface now accepts `type` and
arbitrary additional properties. The `cmake.debugConfig` JSON
schema adds `type` and `additionalProperties: true`.
Fixes#4050
Co-authored-by: Omotola <[email protected]>
* refactor: exclude program from userConfig before Object.assign
Address code review feedback by destructuring program out of
userConfig before overlay, preventing the fragile double-assignment
pattern.
Co-authored-by: Omotola <[email protected]>
* Re-add debug property and update documentation
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: Omotola <[email protected]>
Co-authored-by: Omotola <[email protected]>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
## 1.23
4
4
5
5
Features:
6
+
- Allow specifying a custom debug adapter type in `cmake.debugConfig` via the `type` property. When set, automatic debugger detection is skipped and any debug adapter (e.g., `codelldb`, `lldb`) can be used with arbitrary configuration properties. [#4818](https://github.com/microsoft/vscode-cmake-tools/pull/4818)
6
7
- Add `${cmake.testEnvironment}` placeholder for launch.json that resolves to the CTest `ENVIRONMENT` test property, and automatically include CTest environment variables when debugging tests without a launch configuration. [#4572](https://github.com/microsoft/vscode-cmake-tools/issues/4572)[#4821](https://github.com/microsoft/vscode-cmake-tools/pull/4821)
7
8
- Add "Delete Build Directory and Reconfigure" command that removes the entire build directory before reconfiguring, ensuring a completely clean state. [#4826](https://github.com/microsoft/vscode-cmake-tools/pull/4826)
8
9
- Add `cmake.shell` setting to route CMake/CTest/CPack subprocess invocations through a custom shell (e.g., Git Bash, MSYS2), enabling embedded toolchains that require POSIX path translation on Windows. [#1750](https://github.com/microsoft/vscode-cmake-tools/issues/1750)
Copy file name to clipboardExpand all lines: docs/cmake-settings.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ Options that support substitution, in the table below, allow variable references
42
42
|`cmake.ctestArgs`| An array of additional arguments to pass to CTest. |`[]`| yes |
43
43
|`cmake.ctestDefaultArgs`| Default arguments to pass to CTest. |`["-T", "test", "--output-on-failure"]`| no |
44
44
|`cmake.ctestPath`| Path to CTest executable. |`null`| no |
45
-
|`cmake.debugConfig`| The debug configuration to use when debugging a target |`null` (no values) | yes |
45
+
|`cmake.debugConfig`| The debug configuration to use when debugging a target. When `type` is specified, automatic debugger detection is skipped and a custom debug adapter can be used. Additional properties required by the debug adapter can be added freely.|`null` (no values) | yes |
46
46
|`cmake.defaultActiveFolder`| The name of active folder, which be used as default (Only works when `cmake.autoSelectActiveFolder` is disabled). |`""`| no |
47
47
|`cmake.defaultVariants`| Override the default set of variants that will be supplied when no variants file is present. See [CMake variants](variants.md). | See package.json | no |
48
48
|`cmake.deleteBuildDirOnCleanConfigure`| If `true`, delete build directory during clean configure. |`false`| no |
Copy file name to clipboardExpand all lines: docs/debug-launch.md
+21-1Lines changed: 21 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ From there, you can press the play button by the `Launch` node to run it in term
30
30
CMake Tools lets you start a debugger on a target without creating a `launch.json`.
31
31
32
32
> **Note:**
33
-
> Only the debugger from Microsoft's `vscode-ms-vscode.cpptools`extension supports quick-debugging. See [Debug using a launch.json file](#debug-using-a-launchjson-file), below, for information about `launch.json` and using other debuggers.
33
+
> By default, quick-debugging auto-detects the debugger from the CMake cache and uses Microsoft's `vscode-ms-vscode.cpptools`debug adapters (`cppdbg` / `cppvsdbg`). To use a different debug adapter, see [Customize the debug adapter](#customize-the-debug-adapter) below.
34
34
35
35
Start a debugging session on the active target by running the *CMake: Debug* command from the VS Code command palette, by selecting the Debug button in the status bar or CMake Tools sidebar Project Status View, or by pressing the keyboard shortcut (the default is **Shift+F5**).
36
36
@@ -39,6 +39,26 @@ Start a debugging session on the active target by running the *CMake: Debug* com
39
39
> **Note:**
40
40
> Quick-debugging does not let you specify program arguments or other debugging options. See the next section for more options.
41
41
42
+
## Customize the debug adapter
43
+
44
+
You can use any debug adapter with CMake Tools quick-debugging by setting the `type` property in the `cmake.debugConfig` setting. When `type` is specified, CMake Tools skips automatic debugger detection and builds a minimal launch configuration from the selected target, then merges in all properties from `cmake.debugConfig`. This lets you use adapters like `lldb`, `codelldb`, or any other installed debug extension without creating a `launch.json`.
45
+
46
+
Add the following to your `.vscode/settings.json`:
47
+
48
+
```jsonc
49
+
{
50
+
"cmake.debugConfig": {
51
+
"type":"lldb", // any installed debug adapter type
52
+
"request":"launch",
53
+
"stopOnEntry":false
54
+
}
55
+
}
56
+
```
57
+
58
+
Then run **CMake: Debug Target** from the command palette. CMake Tools will automatically fill in `program`, `cwd`, and `name` from the selected target, and apply your settings on top. Any property recognized by the debug adapter can be added to `cmake.debugConfig`.
59
+
60
+
If you omit `type`, CMake Tools falls back to the original behavior: auto-detecting `cppdbg` or `cppvsdbg` from the CMake cache.
61
+
42
62
## Debug using a launch.json file
43
63
44
64
You can specify the working directory or command line arguments for debugging, or use another debugger than the one included with Microsoft's `vscode-ms-vscode.cpptools`, by creating a `launch.json` file.
Copy file name to clipboardExpand all lines: package.nls.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -217,7 +217,8 @@
217
217
]
218
218
},
219
219
"cmake-tools.configuration.cmake.additionalBuildProblemMatchers.code": "The capture group index for an optional diagnostic code.",
220
-
"cmake-tools.configuration.cmake.debugConfig.description": "The debug configuration to use when debugging a target.",
220
+
"cmake-tools.configuration.cmake.debugConfig.description": "The debug configuration to use when debugging a target. When `type` is specified, the auto-detected debugger configuration is skipped and only a minimal base configuration (program, cwd, name) is generated from the target. All other properties are applied from this setting, allowing full control over the debug launch configuration for any debug adapter.",
221
+
"cmake-tools.configuration.cmake.debugConfig.type.description": "The debug adapter type to use (e.g., `cppdbg`, `cppvsdbg`, `lldb`, `codelldb`). When set, skips the automatic debugger detection from the CMake cache and uses this type directly. Any additional properties required by the debug adapter can be added to `#cmake.debugConfig#`.",
221
222
"cmake-tools.configuration.cmake.debugConfig.symbolSearchPath.description": "Visual Studio debugger symbol search paths.",
222
223
"cmake-tools.configuration.cmake.debugConfig.additionalSOLibSearchPath.description": "Paths for GDB or LLDB to search for .so files.",
223
224
"cmake-tools.configuration.cmake.debugConfig.externalConsole.description": "Launch an external console for the program.",
0 commit comments