How to debug C++ code of workbench line by line?

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
jerryust
Posts: 2
Joined: Thu Jul 15, 2021 10:38 am

How to debug C++ code of workbench line by line?

Post by jerryust »

Hi guys, I have managed to build a C++ test workbench using the fcbt.py provided by the FreeCAD source code. Now I have successfully compiled and built the .sln in VS 2019 on Win10 and the test workbench can be called by the FreeCAD_d.exe now.

However I don't know to to debug the C++ source code of the workbench line by line. It seems to me that if I directly put the breakpoints in VS2019, even though the VS debugger is launched in Debug mode the FreeCAD doesn't stop at the breakpoints of the workbench C++ code at all. I think it is because the FreeCAD_d.exe is actually calling the workbench from the Python interface under the "Mod" folder, where the C++ source code is compiled to .pyd file, am I right?

My question is, how to debug the C++ code of the workbench/module on VS2019 and Win10 ? I would like to let the program stop at my breakpoints put in C++ code line and let me see the local variables. I have tried to Google it by I can't find an answer, it seems that all the debugging solutions are for the Python workbenches. Thank you!
Post Reply