Skip to content

Allow custom debug adapter type in cmake.debugConfig#4818

Merged
snehara99 merged 6 commits intomainfrom
copilot/feature-allow-custom-debug-launch-config
Mar 24, 2026
Merged

Allow custom debug adapter type in cmake.debugConfig#4818
snehara99 merged 6 commits intomainfrom
copilot/feature-allow-custom-debug-launch-config

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 14, 2026

This change addresses item #4590

This changes visible behavior

The following changes are proposed:

  • Add type property to cmake.debugConfig that, when set, skips automatic debugger detection from the CMake cache and uses the specified debug adapter directly
  • Allow arbitrary additional properties in cmake.debugConfig via additionalProperties: true in the schema and an index signature on CppDebugConfiguration
  • Update debugTarget() and debugCTest() in cmakeProject.ts to branch: custom type path builds a minimal base config from the target (program, cwd, name, args), then overlays the user config; otherwise falls through to existing cache-based auto-detection

The purpose of this change

cmake.debugConfig was limited to a fixed set of cppdbg/cppvsdbg properties (MIMode, miDebuggerPath, etc.). Users wanting a different debug adapter (e.g., codelldb, lldb) had no way to specify one — the adapter type was always auto-detected from the CMake cache.

Other Notes/Information

Example — using CodeLLDB instead of the auto-detected debugger:

// settings.json
{
  "cmake.debugConfig": {
    "type": "lldb",
    "sourceMap": { "/build": "${workspaceFolder}" },
    "initCommands": ["settings set target.x86-disassembly-flavor intel"]
  }
}

program, cwd, args, name, and environment are still populated automatically from the CMake target. When type is omitted, behavior is unchanged — the debugger is auto-detected from the cache as before.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature] Allow ability to specify custom debug launch configuration</issue_title>
<issue_description>### Request Overview

Currently cmake-tools has a hardcoded Debug Launch Configuration, e.g.:

return {
type: 'cppdbg',
name: `Debug ${target.name}`,
request: 'launch',
cwd: path.dirname(target.path),
args: [],
MIMode: MIModes.lldb,
miDebuggerPath: debuggerPath,
program: target.path
};
}

And it only allows user to specify a limited number of parameters: MIMode, miDebuggerPath.

In Contrast, TestMate extension: ( https://github.com/matepek/vscode-catch2-test-adapter ) allows users to specify Debug Launch Configuration for each platform independently, as follows:
https://github.com/matepek/vscode-catch2-test-adapter/blob/master/documents/configuration/debug.configTemplate.md

Could you maybe add ability to the CMake Tools to do the same, i.e. add ability to specify debug template, which will streamline and simplify development workflow.
Additionally it would fix/workaround the issues, like: #3908

Additional Information

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Copilot AI and others added 2 commits March 14, 2026 01:39
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 <8052624+Omotola@users.noreply.github.com>
Address code review feedback by destructuring program out of
userConfig before overlay, preventing the fragile double-assignment
pattern.

Co-authored-by: Omotola <8052624+Omotola@users.noreply.github.com>
Copilot AI changed the title [WIP] [Feature] Allow ability to specify custom debug launch configuration Allow custom debug adapter type in cmake.debugConfig Mar 14, 2026
Copilot AI requested a review from Omotola March 14, 2026 01:44
@Omotola Omotola marked this pull request as ready for review March 21, 2026 01:42
@Omotola
Copy link
Copy Markdown
Contributor

Omotola commented Mar 21, 2026

validated locally
Debugger is able to use custom settings defined in settings.json
image

Copy link
Copy Markdown
Collaborator

@gcampbell-msft gcampbell-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I'm good with this change, just want to make sure we have clarity on some of the modifications/additions

Comment thread src/debug/debugger.ts
Comment thread package.json
Copilot AI requested a review from Omotola March 24, 2026 16:53
@microsoft microsoft deleted a comment from Copilot AI Mar 24, 2026
@Omotola
Copy link
Copy Markdown
Contributor

Omotola commented Mar 24, 2026

@copilot can you resolve the merge conflicts in this PR

…-custom-debug-launch-config

# Conflicts:
#	CHANGELOG.md
#	src/cmakeProject.ts
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 24, 2026

@copilot can you resolve the merge conflicts in this PR

Merge conflicts resolved in df1b9f3. Two conflicts were fixed:

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 40vvsblobprodwus2135.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /usr/local/bin/yarn install --frozen-lockfile (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/_temp/ghcca-node/node/bin/npm install --ignore-scripts (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/_temp/ghcca-node/node/bin/npm install typescript --no-save (dns block)
  • 5azvsblobprodwus2162.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/_temp/ghcca-node/node/bin/npm install --ignore-scripts (dns block)
  • 5bdvsblobprodwus2128.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/_temp/ghcca-node/node/bin/npm install --ignore-scripts (dns block)
  • 78kvsblobprodwus2152.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /usr/local/bin/yarn install --frozen-lockfile (dns block)
  • 7t8vsblobprodwus2168.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/_temp/ghcca-node/node/bin/npm install --ignore-scripts (dns block)
  • b53vsblobprodwus2154.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /usr/local/bin/yarn install --frozen-lockfile (dns block)
  • ezcvsblobprodwus2170.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/_temp/ghcca-node/node/bin/npm install --ignore-scripts (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/_temp/ghcca-node/node/bin/npm install typescript --no-save (dns block)
  • km4vsblobprodwus2183.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /usr/local/bin/yarn install --frozen-lockfile (dns block)
  • l7ivsblobprodwus2133.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /usr/local/bin/yarn install --frozen-lockfile (dns block)
  • v41vsblobprodwus2175.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /usr/local/bin/yarn install --frozen-lockfile (dns block)
  • vd2vsblobprodwus2150.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /usr/local/bin/yarn install --frozen-lockfile (dns block)
  • wztvsblobprodwus2155.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /usr/local/bin/yarn install --frozen-lockfile (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@snehara99 snehara99 merged commit 3b37f6b into main Mar 24, 2026
4 checks passed
@snehara99 snehara99 deleted the copilot/feature-allow-custom-debug-launch-config branch March 24, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Allow ability to specify custom debug launch configuration

4 participants