Debugging with GDB¶
A debugger can be used to inspect the state of an application in the event of a crash.
Compile Debug Build¶
How to make a debug build depends on the build system used:
- For Linux/macOS set:
CMAKE_BUILD_TYPE=Debug
inCMakeCache.txt
- For Visual Studio, set the Release Configuration to Debug
Run GDB¶
Start GDB by changing the working directory to the location of your new debug build and typing one of the following, depending on the platform:
Then to start Blender, type:
Now make Blender crash. Blender will freeze, so switch to the GDB prompt. Get a backtrace by typing:
A more complete backtrace can be printed using:
For more information, see this guide: How to Get a Backtrace.
Run Immediately¶
Blender can be made to run immediately:
Run With Environment Variables Set¶
Blender can be run with environment variables using env
.
These options disable some ASAN checks can interfere with debugging: