Running Acron under the C++ Debugger

A C++ game is an ordinary CMake program (see Building C++ Games for the Desktop), so any C++ debugger runs it: Visual Studio on Windows, Xcode or lldb on macOS, gdb or lldb on Linux.

Build the game with debug information. With acronmanager, set the build type in pyproject.toml; a variant with a build directory of its own keeps the release build as it is:

[tool.acron.cmake]
target = "mygame"

[tool.acron.scripts]
debug = { cmake_target = "mygame", build_dir = "build/debug",
          configure_args = ["-DCMAKE_BUILD_TYPE=Debug"] }

acronmanager build debug compiles it into build/debug. By hand, pass -DCMAKE_BUILD_TYPE=Debug (or RelWithDebInfo) when configuring, or choose the configuration in a multi-configuration generator such as Visual Studio’s.

Then start the program under the debugger from the project’s folder, so it finds its files as it does when run normally:

lldb build/debug/mygame        # or: gdb --args build/debug/mygame

On Windows, open the project folder in Visual Studio (File > Open > Folder; it reads CMakeLists.txt itself), select the game as the startup item and press F5. Add the SDK’s bin folder to the PATH of the debug environment, since the engine’s DLLs are there.

The engine’s libraries in the SDK are release builds without debug information: the debugger steps through your code and shows the engine’s functions in a call stack by name, but not their source lines. The engine reports most mistakes through its notify system before they turn into a crash; raise its verbosity (notify-level-<category> debug, see Log Messages) to see more of what it does.