Sysprogs forums › Forums › VisualGDB › Change Debugged Application
Tagged: CMake Target Executable
- This topic has 3 replies, 2 voices, and was last updated 2 years, 2 months ago by support.
-
AuthorPosts
-
August 1, 2022 at 12:52 #32918NoahParticipant
Hello,
I’ve got multiple different build configurations and I’d like to be able to switch configurations and debug them. So far, I can’t find a way to have configuration-dependent executable paths, I cannot find a setting in VisualGDB to allow my to point at a “.elf” file other than the one in the default location in “$(ProjectDir)/Debug/DEBUG/”; and I can’t find where this variable is defined either.
I have included a screenshot below where I am trying to download and ‘debug’ the Release configuration as a test (I am aware that this will not “debug” properly, but it should at least download and attempt to attach).
I am hoping to have some light shed on how to change which .elf is used for debugging depending on the active configuration.
Thank you for the help!
Attachments:
You must be logged in to view attached files.August 1, 2022 at 19:55 #32922supportKeymasterHi,
For CMake projects, the debugged executable path is automatically derived from the actual project structure. If you would like to debug arbitrary executables, we would advise using Quick Debug instead.
If you would like to have multiple debug configurations, you can try using the configuration/platform manager. Simply add a CMake-level variable in the configuration settings, and then check it on the CMake statement level (e.g. using the ${} syntax or in conditional statements) to produce different executables in different configurations.
VisualGDB will automatically pick up the correct executable based on the active platform.
If this is not what you are looking for, please let us know more what you are trying to accomplish, and we will try to suggest a better solution.
August 2, 2022 at 07:24 #32926NoahParticipantOk, thanks for the response. I should clarify a bit more: I’m seeing a few problems that are maybe related. I’ll go through the steps to produce what I am seeing and what I expect.
Debug Configuration
If I select the Debug configuration in VisualGDB and press Start then everything works and debugs normally.
Release Configuration
When I switch to the Release configuration using the dropdown menu in the toolbar, a few things happen.
The first notable thing is an exception traceback that shows up in the “VisualGDB Build” tab. It starts off
"CMake Error: CMake server mode has been removed in favor of the file-api."
and then prints a traceback (see CMakeErrorTraceback.png). Doing a “Clean and Reconfigure CMake Project” produces an error that says “The operation has timed out.”Deleting the
build/
directory and retrying does not help.I can do a clean rebuild and the configure and build steps will both succeed; although the solution explorer will still display the project as having failed to configure.
To get past this for now, I do a clean rebuild and then click “Start.”
I then get an error that VisualGDB failed to start the debug session because it could not find the image in
build/VisualGDB/Debug/DEBUG
(See IncorrectImagePath.png).This debug folder does not exist, nor should it. Instead Release builds are located in
build/VisualGDB/Release/RELEASE
. It seems like VisualGDB should be looking in the Release directory tree for the image, if that’s where CMake is putting the output executable.The CMake Binary directory is also correct (see BinaryDirectory.png), I would have thought that VisualGDB would use the ${CMAKE_BINARY_DIR} variable to determine where the executable is placed.
Thank you for the help,
Noah
Attachments:
You must be logged in to view attached files.August 2, 2022 at 08:57 #32935supportKeymasterHi,
We have just rechecked the switching between the debug and release configurations and it worked just fine.
Most likely, you have changed some project settings to the values preventing VisualGDB from loading it.
Please try creating a new project from scratch and check if the problem persists. If not, please try comparing the settings between the 2 projects and eliminating the differences one-by-one.
-
AuthorPosts
- You must be logged in to reply to this topic.