Skip to content
Snippets Groups Projects
Debugging-with-Vscode.md 1.95 KiB

Debugging with VSCode

We can debug our VirtualFluids application within the docker container in VS Code. This wiki page describes how to do that.

  1. 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).

  2. 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: devcontainer_vscode

    A file to start from can be found here: launch.json.

  3. A very important entry in this file is "program": . Here we need to add the path to the executable we want to debug.

  4. 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:

    devcontainer_vscode

    The debugging can be started in the debugging tab:

    devcontainer_vscode

    Here we can also monitor variables and the call stack:

    devcontainer_vscode

Additionally VS Code provides a nice documentation as well: