Skip to content

Updating CMake Debugging Docs to have CMake Debugger #4778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
bae8e00
New screenshots for updating cmake debugging
sinemakinci1 Oct 20, 2023
0e9c739
Update configure-cmake-debugging-sessions.md
sinemakinci1 Oct 20, 2023
3e2bf76
Update configure-cmake-debugging-sessions.md
sinemakinci1 Oct 20, 2023
94276d0
Add files via upload
sinemakinci1 Oct 20, 2023
83fc97c
Add files via upload
sinemakinci1 Oct 23, 2023
97765a0
Update configure-cmake-debugging-sessions.md
sinemakinci1 Oct 23, 2023
ac2403f
Update configure-cmake-debugging-sessions.md
sinemakinci1 Oct 23, 2023
e671d30
Update configure-cmake-debugging-sessions.md
sinemakinci1 Oct 23, 2023
495e692
Update configure-cmake-debugging-sessions.md
sinemakinci1 Oct 23, 2023
a6b75a4
Update configure-cmake-debugging-sessions.md
sinemakinci1 Oct 23, 2023
d3062ca
Update configure-cmake-debugging-sessions.md
sinemakinci1 Oct 23, 2023
9f466d6
Update configure-cmake-debugging-sessions.md
sinemakinci1 Oct 23, 2023
2239fff
Update configure-cmake-debugging-sessions.md
sinemakinci1 Oct 23, 2023
c397b37
Update configure-cmake-debugging-sessions.md
sinemakinci1 Oct 23, 2023
de6a624
Update configure-cmake-debugging-sessions.md
sinemakinci1 Oct 24, 2023
6fa9a74
Update configure-cmake-debugging-sessions.md
sinemakinci1 Oct 24, 2023
b9e7058
Update configure-cmake-debugging-sessions.md
sinemakinci1 Oct 24, 2023
4492d0a
Update configure-cmake-debugging-sessions.md
sinemakinci1 Oct 24, 2023
e79346c
Update configure-cmake-debugging-sessions.md
sinemakinci1 Oct 24, 2023
3cc7178
Update configure-cmake-debugging-sessions.md
sinemakinci1 Oct 24, 2023
c4fb5b0
Update configure-cmake-debugging-sessions.md
sinemakinci1 Oct 24, 2023
8b9cc44
Apply suggestions from PR review
Court72 Oct 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions docs/build/configure-cmake-debugging-sessions.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,28 @@ Native CMake support is available in Visual Studio 2017 and later. To see the do

All executable CMake targets are shown in the **Startup Item** dropdown in the toolbar. Select one to start a debugging session and launch the debugger.

![Screenshot of the CMake startup item dropdown.](media/cmake-startup-item-dropdown.png "CMake startup item dropdown")
:::image type="complex" source="media/new-dropdowns.png" alt-text="Screenshot of the CMake startup items.":::
There is a play button dropdown to select the current debug target. It shows your debug targets. In this example, the HelloWorld.exe debug target is available.
:::image-end:::

You can also start a debug session from Solution Explorer. First, switch to **CMake Targets View** in the **Solution Explorer** window.

![Screenshot of the CMake targets view command.](media/cmake-targets-view.png "CMake Targets View menu item")
:::image type="complex" source="media/switch-to-targets-view.png" alt-text="Screenshot of the CMake Targets View menu":::
The solution explorer is shown. A right-click on an item in the Folder View has opened a menu. On that menu, the Switch to Targets View item is highlighted.
:::image-end:::

Then, right-click on an executable and select **Debug**. This command automatically starts debugging the selected target based on your active configuration.

:::image type="complex" source="media/debug-targets-view.png" alt-text="Screenshot of the CMake Targets View debug option menu":::
When you right click on a target in the CMake Targets view, there is an option to debug a chosen target. The Debug option is highlighted.
:::image-end:::

Starting in Visual Studio 2022 Version 17.6, you can also start a debugging session on your CMakeLists.txt file. To do so, just set a breakpoint in your CMakeLists.txt file and run **Configure Project with CMake Debugger** from the **Project** dropdown

:::image type="complex" source="media/cmake-debugger-entry.png" alt-text="Screenshot of the CMake Debugger dropdown":::
The Project dropdown is shown. The option to Configure Project with CMake debugger is highlighted.
:::image-end:::

## Customize debugger settings

You can customize the debugger settings for any executable CMake target in your project. They're found in a configuration file called *launch.vs.json*, located in a *`.vs`* folder in your project root. A launch configuration file is useful in most debugging scenarios, because you can configure and save your debugging setup details. There are three entry points to this file:
Expand Down
Binary file added docs/build/media/cmake-debugger-entry.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/build/media/cmake-targets-view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/build/media/debug-targets-view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/build/media/new-dropdowns.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/build/media/switch-to-targets-view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.