-
Anna Wellmann authoredAnna Wellmann authored
Debugging with VSCode
We can debug our VirtualFluids application within the docker container in VS Code. This wiki page describes how to do that.
-
Most important: VirtualFluids default build is Release. For debugging, the build type must be changed during the cmake process:
cmake --preset=all_make -DCMAKE_BUILD_TYPE=Debug ..
The variable
CMAKE_BUILD_TYPE
is a native cmake variable and used to specifiy the build type. The available options are: Debug, Release, RelWithDebInfo, MinSizeRel (cmake-doc). -
In VS Code we can now add a debug configuration file to our project. The debugging configuration information is stored in the file
.vscode/launch.json
. To add the first debug configuration, we need to create this file manually.Then one possible configuration for gdb may look like this:
A file to start from can be found here: launch.json.
-
A very important entry in this file is
"program":
. Here we need to add the path to the executable we want to debug. -
Now we can start debugging by adding a breakpoint to the specific file. To do this, we click on a line number on the left:
The debugging can be started in the debugging tab:
Here we can also monitor variables and the call stack:
Additionally VS Code provides a nice documentation as well: