Debug Learning

I would like mainly for learning purposes at the moment to get familiar with how Cycles works. I have a solid grasp on the fundamentals but I’m a bit intimidated with the actual implementation in C++.

The way I usually go about this is by stepping through the code in debug mode. I have the basic setup in Visual Studio building correctly but can’t figure out how I would go about launching a render and hitting a breakpoint / getting into debug mode to start stepping through it.

Is there any documentation outlining the basic flow of a cycles render and how Cycles is integrated into Blender?

I think it would be a useful thing for the core dev team to work on as it would help people that want to contribute get up to speed faster.

If you have a debug build ready just go into that subfolder, it should be called something like “build_windows_x64_vc16_Debug”.
From there jump into the “bin” subfolder and run the “blender.exe”.
Now in Visual Studio under the “debug” menu entry you can select “attach to process”. In the List select “blender.exe”. If you did everything correctly you should now be debugging and be able to hit your break points.

This works for me when using visual studio. If you want to use visual studio code you can refer to this link: https://wiki.blender.org/wiki/Developer_Intro/Environment/Portable_CMake_VSCode

1 Like

Getting this error after building the Debug build and trying to manually launch it.

What the debug folder looks like:

When I want to build a debug build of blender i use this command:
“make debug developer”
I am not sure, but I dont think you can work with the debug subfolder of a build built with “release” target like you do.

Have a look at this wiki page: https://wiki.blender.org/wiki/Building_Blender/Options

Ok yup, I built it from VS. Will try with the command. Thanks!!!

The code documentation we have is here:
https://wiki.blender.org/wiki/Source/Render/Cycles

This looks like the INSTALL target was not built for the debug build.
https://wiki.blender.org/wiki/Building_Blender/Windows#Compile_Blender_2

Got it working! Good day ahead :slight_smile: