How can I compile a Debug build in Ubuntu Linux 18.04 and attatch a debugger with breakpoints?

I’m currently working on a (very basic) modifier, using VSCode to code on Linux and the provided make command line tools for compiling. The UI part of the modifier is done, but when I try to add the actual functionality, my code crashes Blender once the user adds the modifier to the model. I’m not seeking help on how to fix the crash itself, I’d rather like to learn how I can investigate this without too much trial and error by creating a Debug build and looking at variable contents and more descriptive error messages.

On Windows, I can use Visual Studio Community edition and compile for the Debug target, then run Blender with a Debugger attatched. How would I do something similar on Linux? Preferrably with VSCode, setting break points and the like?

1 Like

You would need to make a debug build, either with make debug or by editing the cmake configuration to change from Release to Debug.

In VS Code there is a C/C++ extension. You just need to configure the debugging, setting program to point to the Blender debug binary.

1 Like

awesome, thanks Brecht!