VS 2020 Debugging Now Works - was: Newb debugging question

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
falviani
Posts: 253
Joined: Tue May 07, 2019 8:49 pm

VS 2020 Debugging Now Works - was: Newb debugging question

Post by falviani »

Hi All

I am working on a small workbench in python. The freecad version I'm using is:

Code: Select all

OS: Windows 10 (10.0)
Word size of FreeCAD: 64-bit
Version: 0.21.29393 (Git)
Build type: Release
Branch: master
Hash: 6820e0a9ec85203a6f342ca72a2ff8fd417beaf1
Python 3.8.13, Qt 5.12.9, Coin 4.0.0, Vtk 9.1.0, OCC 7.5.3
Locale: English/United States (en_US)
Installed mods: 
  * FC_TabbedBoxWorkbench
I have tried building a debug version from source, but have the same results.

For various reasons, I've been away from development for a number of months, and have switched from VS2019 to VS2022. The procedure I use has been:
1) Launch FreeCAD
2a) From VS2022 attach to the FreeCAD process.
2b) From VS2022 place 1 or more breakpoints in my code, including the init_gui routine. VS2022 flags all breakpoints with a "no symbols have been loaded" warning.
3) From FreeCAD switch to my workbench.

At this point I expect to break in VS2022 but nothing happens. Where I have breakpoints I can see a stack trace in the report pane, but no break in VS2022.

I know I'm overlooking something obvious - could somebody suggest what I need to do?

Thanks in advance,
Frank
Last edited by falviani on Thu Jul 14, 2022 11:32 pm, edited 2 times in total.
xianyu
Posts: 66
Joined: Mon Jun 27, 2022 7:34 am

Re: Newb debugging question

Post by xianyu »

Hi,falviani
I had a similar problem as you,but I am using vscode.
https://forum.freecadweb.org/viewtopic. ... 90#p607890


I have tried using Visual Studio 2019 to debug.I set "FreeCAD_d.exe" as the startup item.When I add a breakpoint in python file, it also prompts me,
"the breakpoint will not currently be hit.no symbols have been loaded for this document"
This might help you,
https://qawithexperts.com/article/asp-n ... -in-vi/257
I didn't succeed, could you share with me if you have a solution to the problem?
Freecad novice, A Python enthusiast
falviani
Posts: 253
Joined: Tue May 07, 2019 8:49 pm

Re: Newb debugging question

Post by falviani »

Hi Xianyu,

I tried your suggestions, but they didn't work; the MS references seemed to be focused on C# projects.

I need to try and track down why I get
"Warning (active) reportMissingImports Import "FreeCAD" could not be resolved C:\Users\frank\AppData\Roaming\FreeCAD\Mod\FC_TabbedBoxWorkbench\freecad\TabbedBoxWorkbench\commands\support.py 3 "
errors for all of the FreeCAD units.

I will update this thread as I find stuff out (hopefully I DO find stuff out). The documentation on the wiki about debugging is, IMHO, virtually non-existent.

Thanks for replying,
Frank
xianyu
Posts: 66
Joined: Mon Jun 27, 2022 7:34 am

Re: Newb debugging question

Post by xianyu »

Hi,falviani
I have given up using Visual Studio 2019.
If you're still using VScode for debugging, try this.
https://forum.freecadweb.org/viewtopic.php?f=22&t=70042
Freecad novice, A Python enthusiast
falviani
Posts: 253
Joined: Tue May 07, 2019 8:49 pm

Re: Newb debugging question

Post by falviani »

I have debugging working in VS2020! I found the following change made it possible to import the symbols and get the program to break as required:
VS2020_debugging_settings.png
VS2020_debugging_settings.png (34.57 KiB) Viewed 875 times
These settings are off by default, so just turn them on; the change seems persistent.

Let me know if this works for you.

Frank
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: VS 2020 Debugging Now Works - was: Newb debugging question

Post by Kunda1 »

can anyone confirm this?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply