-
Notifications
You must be signed in to change notification settings - Fork 457
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script mode and ability to connect to externally launched CMake p…
…rocess. (#3277) * storing initial thoughts * rough version of trying to work on new options for debugger configurations * made progress enabling script debugging from launch.json * add some output messaging regarding the debugger and script * add TODO's in case I don't get to it today * log statements, ensure package.json allows the right args in right situation, set up env for script debugging * push worst case copying the description and settings of the debugger options * I think I've covered all launch config cases * better package.json schema, though still not perfect, matches other debug types, and stub validation in code * localize error messages * add 'The' * switch to double quotes * add docs page for debugging * slight modifications * didn't handle case where scriptEnv was undefined * add configurationSnippets * add stub for debugconfigurationprovider * add ability to 'run and debug' without launch.json on *.cmake files * modify when we sanity check * make adjustments based on feedback and add automatic configuration * ensure that configure with debugger works with the right format * update changelog
- Loading branch information
1 parent
b4bd314
commit 661e9ed
Showing
11 changed files
with
470 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# CMake Debugging | ||
|
||
Starting with CMake 3.27, debugging CMake is supported in CMake Tools. | ||
|
||
The following documentation will help you understand the various ways you can debug CMake scripts and cache generation. | ||
|
||
## Debugging from CMake Tools UI entry points | ||
|
||
The most common reason to debug CMake scripts and cache generation is to debug CMake cache generation. There are many ways that you can accomplish this: | ||
|
||
* Commands | ||
* CMake: Configure with CMake Debugger | ||
* CMake: Delete Cache and Reconfigure with CMake Debugger | ||
* Folder Explorer | ||
* Right click on CMakeLists.txt -> Configure All Projects with CMake Debugger. | ||
* Project Outline | ||
* Right click on CMakeLists.txt -> Configure All Projects with CMake Debugger. | ||
* Expand the "..." in the project outline. There is an entry to use the Debugger. | ||
|
||
## Debugging from launch.json | ||
|
||
CMake Tools provides a new debug type `cmake`. | ||
|
||
The `cmake` debug type supports three different types of `cmakeDebugType`: `configure`, `external`, `script`. They each come with their own settings that can be used to modify and control the debug session. | ||
|
||
### Example launch.json | ||
|
||
```json | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "cmake", | ||
"request": "launch", | ||
"name": "CMake script debugging", | ||
"cmakeDebugType": "script", | ||
"scriptPath": "${workspaceFolder}/<script>.cmake" | ||
}, | ||
{ | ||
"type": "cmake", | ||
"request": "launch", | ||
"name": "Debug externally launched CMake process", | ||
"cmakeDebugType": "external", | ||
"pipeName": "<insert-pipe-name>" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
Listed below are the settings that are available for each configuration based on `cmakeDebugType`: | ||
|
||
* `configure` | ||
* required: none | ||
* optional | ||
* `pipeName` - Name of the pipe (on Windows) or domain socket (on Unix) to use for debugger communication. | ||
* `clean` - Clean prior to configuring. | ||
* `configureAll` - Configure for all projects. | ||
* `dapLog` - Where the debug adapter protocol (DAP) communication should be logged. If omitted, DAP communication is not logged. | ||
* `external` | ||
* required | ||
* `pipeName` - Name of the pipe (on Windows) or domain socket (on Unix) to use for debugger communication. | ||
* optional | ||
* `script` | ||
* required | ||
* `scriptPath` - The path to the CMake script to debug. | ||
* optional | ||
* `scriptArgs` - Arguments for the CMake script to debug. | ||
* `scriptEnv` - Environment for the CMake script to use. | ||
* `pipeName` - Name of the pipe (on Windows) or domain socket (on Unix) to use for debugger communication. | ||
* `dapLog` - Where the debug adapter protocol (DAP) communication should be logged. If omitted, DAP communication is not logged. | ||
|
||
The `cmake` debug type only supports the `request` type: `launch`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.