Debugging C++ Code

Visual Studio Debug Visualizers

To ease debugging the C++ code, we provide a natvis file, located at Utilities/Visual Studio Visualizer/ezEngine.natvis. The file adds improved inspection for ez specific code, such as the container and string classes.

This file is already referenced by our CMake scripts in the Foundation library and therefore works out of the box.

Debugging the Editor

Please be aware that the editor uses at least one, but potentially multiple child processes for its operation. Everything that is actually 3D rendered, is done by the EditorEngineProcess, which is spawned when the editor opens a project. This makes the editor more resilient. However, it means that if you launch the editor in a debugger, by default breakpoints inside the engine runtime code cannot be hit, as you are not attached to the right process.

The easiest way to fix this, is to use an extension for Visual Studio: Microsoft Child Process Debugging Power Tool

This tool enables Visual Studio to automatically attach to all child processes spawned by the parent process, which makes debugging the ez editor much easier.

After installing the extension go to Debug > Other Debug Targets > Child Process Debugging Settingsā€¦. There you need to enable child process debugging. Additionally, you may want to exclude debugging Git (git.exe) and Visual Studio Code (code.exe), as those may be spawned by the ez editor (indirectly) and have some annoying behavior when attached to with a debugger:

Child Debug Settings

See Also