Debugging/ro: Difference between revisions
(Updating to match new version of source page) |
(Updating to match new version of source page) |
||
(13 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<languages/> |
<languages/> |
||
<div class="mw-translate-fuzzy"> |
|||
{{Docnav/ro |
{{Docnav/ro |
||
|[[Module Creation/ro|Module Creation]] |
|[[Module Creation/ro|Module Creation]] |
||
|[[Testing/ro|Testing]] |
|[[Testing/ro|Testing]] |
||
}} |
}} |
||
</div> |
|||
{{TOCright}} |
{{TOCright}} |
||
<span id="Test_First"></span> |
|||
<div class="mw-translate-fuzzy"> |
<div class="mw-translate-fuzzy"> |
||
== Testează mai întâi == |
== Testează mai întâi == |
||
Line 12: | Line 18: | ||
Before you go through the pain of debugging use the [[Testing|Test framework]] to check if the standard tests work properly. If they do not run complete there is possibly a broken installation. |
Before you go through the pain of debugging use the [[Testing|Test framework]] to check if the standard tests work properly. If they do not run complete there is possibly a broken installation. |
||
<span id="Command_Line"></span> |
|||
<div class="mw-translate-fuzzy"> |
<div class="mw-translate-fuzzy"> |
||
== Linie de Commandă == |
== Linie de Commandă == |
||
Line 19: | Line 26: | ||
The ''debugging'' of FreeCAD is supported by a few internal mechanisms. The command line version of FreeCAD provides some options for debugging support. |
The ''debugging'' of FreeCAD is supported by a few internal mechanisms. The command line version of FreeCAD provides some options for debugging support. |
||
<div class="mw-translate-fuzzy"> |
|||
Acestea sunt opțiunile recunoscute curent în FreeCAD 0.15: |
Acestea sunt opțiunile recunoscute curent în FreeCAD 0.15: |
||
</div> |
|||
<div class="mw-translate-fuzzy"> |
|||
Generic options: |
Generic options: |
||
-v [ --version ] Prints version string |
-v [ --version ] Prints version string |
||
Line 26: | Line 36: | ||
-c [ --console ] Starts in console mode |
-c [ --console ] Starts in console mode |
||
--response-file arg Can be specified with '@name', too |
--response-file arg Can be specified with '@name', too |
||
</div> |
|||
<div class="mw-translate-fuzzy"> |
|||
Configuration: |
Configuration: |
||
-l [ --write-log ] Writes a log file to: |
-l [ --write-log ] Writes a log file to: |
||
Line 37: | Line 49: | ||
-M [ --module-path ] arg Additional module paths |
-M [ --module-path ] arg Additional module paths |
||
-P [ --python-path ] arg Additional python paths |
-P [ --python-path ] arg Additional python paths |
||
</div> |
|||
<span id="Generating_a_Backtrace"></span> |
|||
<div class="mw-translate-fuzzy"> |
<div class="mw-translate-fuzzy"> |
||
== Generarea unei Backtrace == |
== Generarea unei Backtrace == |
||
Line 57: | Line 71: | ||
<div class="mw-translate-fuzzy"> |
<div class="mw-translate-fuzzy"> |
||
* varianta software de package gdb instalat |
* varianta software de package gdb instalat |
||
* o depanare a variantei compilate a FreeCAD (în acest moment disponibilă prin [[ |
* o depanare a variantei compilate a FreeCAD (în acest moment disponibilă prin [[Compile_on_Linux#For_a_Debug_build|building from source]]) |
||
* un model FreeCAD care a cauzat crash-ul |
* un model FreeCAD care a cauzat crash-ul |
||
</div> |
</div> |
||
Line 63: | Line 77: | ||
Pași: |
Pași: |
||
Introduceți următoarelor în fereastra terminalului dvs: |
Introduceți următoarelor în fereastra terminalului dvs: |
||
Find FreeCAD binary on your system: |
|||
{{Code|code= |
{{Code|code= |
||
$ whereis freecad |
|||
$ cd FreeCAD/bin |
|||
freecad: /usr/local/freecad <--- for example |
|||
$ cd /usr/local/freecad/bin |
|||
$ gdb FreeCAD |
$ gdb FreeCAD |
||
}} |
}} |
||
Line 92: | Line 111: | ||
</div></div> <!-- END OF COLLAPSIBLE DIV --> |
</div></div> <!-- END OF COLLAPSIBLE DIV --> |
||
<span id="For_macOS"></span> |
|||
<div class="mw-translate-fuzzy"> |
|||
=== For MacOSX === |
=== For MacOSX === |
||
</div> |
|||
<!-- START OF COLLAPISBLE DIV --><div class="toccolours mw-collapsible mw-collapsed" style="width:800px;"> |
<!-- START OF COLLAPISBLE DIV --><div class="toccolours mw-collapsible mw-collapsed" style="width:800px;"> |
||
<div class="mw-translate-fuzzy"> |
|||
MacOSX Debugging → |
|||
MacOSX Debugging → |
|||
</div> |
|||
<div class="mw-collapsible-content"> |
<div class="mw-collapsible-content"> |
||
Line 132: | Line 156: | ||
== List Libraries Loaded by FreeCAD == |
== List Libraries Loaded by FreeCAD == |
||
(Applicable to Linux and |
(Applicable to Linux and macOS) |
||
Sometimes it's helpful to understand what libraries FreeCAD is loading, specifically if there are multiple libraries being loaded of the same name but different versions (version collision). In order to see which libraries are loaded by FreeCAD when it crashes you should open a terminal and run it in the debugger. In a second terminal window, find out the process id of FreeCAD: |
Sometimes it's helpful to understand what libraries FreeCAD is loading, specifically if there are multiple libraries being loaded of the same name but different versions (version collision). In order to see which libraries are loaded by FreeCAD when it crashes you should open a terminal and run it in the debugger. In a second terminal window, find out the process id of FreeCAD: |
||
Line 146: | Line 170: | ||
{{incode|lsof -p process_id | grep Coin}} |
{{incode|lsof -p process_id | grep Coin}} |
||
<span id="Python_Debugging"></span> |
|||
<div class="mw-translate-fuzzy"> |
<div class="mw-translate-fuzzy"> |
||
== Python Debugging == |
== Python Debugging == |
||
Line 168: | Line 193: | ||
Here is an example of using ''Winpdb'' inside FreeCAD: |
Here is an example of using ''Winpdb'' inside FreeCAD: |
||
<div class="mw-translate-fuzzy"> |
|||
Avem nevoie de depanatorul Python: '' Winpdb ''. Dacă nu aveți instalat, instalați-l sub Ubuntu / Debian cu: |
Avem nevoie de depanatorul Python: '' Winpdb ''. Dacă nu aveți instalat, instalați-l sub Ubuntu / Debian cu: |
||
</div> |
|||
{{Code|code= |
{{Code|code= |
||
Line 181: | Line 208: | ||
</div> |
</div> |
||
<div class="mw-translate-fuzzy"> |
|||
Acum vom rula pas cu pas un script de testare Python în FreeCAD. |
Acum vom rula pas cu pas un script de testare Python în FreeCAD. |
||
</div> |
|||
# Rulați winpdb și definiți password (e.g. test) |
# Rulați winpdb și definiți password (e.g. test) |
||
Line 219: | Line 248: | ||
Prerequisites: |
Prerequisites: |
||
* ptvsd package |
* The ptvsd package needs to be installed in a Python 3 outside of FreeCAD, then the module must be copied to FreeCAD's Python library folder. |
||
{{Code|code= |
{{Code|code= |
||
# In a cmd window that has a path to you local Python 3: |
|||
pip install ptvsd |
pip install ptvsd |
||
# Then if your Python is installed in C:\Users\<userid>\AppData\Local\Programs\Python\Python37 |
|||
# and your FreeCAD is installed in C:\freecad\bin |
|||
xcopy "C:\Users\<userid>\AppData\Local\Programs\Python\Python37\Lib\site-packages\ptvsd" "C:\freecad\bin\Lib\site-packages\ptvsd" |
|||
}} |
}} |
||
Line 240: | Line 273: | ||
}} |
}} |
||
* Add a debug configuration in Visual Studio Code {{MenuCommand|Debug → Add Configurations…}}. |
* Add a debug configuration in Visual Studio Code {{MenuCommand|Debug → Add Configurations…}}. |
||
* The config should look like this: |
|||
<!--NOT CHANGE THE <pre> </pre> BALISE CAUSE THE PIPE OR SPACE IN MACRO CODE CUT THE MACRO--> |
<!--NOT CHANGE THE <pre> </pre> BALISE CAUSE THE PIPE OR SPACE IN MACRO CODE CUT THE MACRO--> |
||
Line 262: | Line 296: | ||
* In VS Code add a breakpoint anywhere you want. |
* In VS Code add a breakpoint anywhere you want. |
||
* Launch the script in FreeCAD. FreeCAD freeze waiting for attachment. |
* Launch the script in FreeCAD. FreeCAD freeze waiting for attachment. |
||
* In VS Code start debugging |
* In VS Code start debugging using created configuration. You should see variables in debugger area. |
||
* When setting breakpoints, VS Code will complain about not finding the .py file opened in the VS Code editor. |
|||
** Change "remoteRoot": "." to "remoteRoot": "<directory of file>" |
|||
*** For example, if the Python file resides in ''/home/FC_myscripts/myscript.py'' |
|||
*** Change to: "remoteRoot": "/home/FC_myscripts" |
|||
** If you're just debugging FreeCAD macros from the FreeCAD macro folder, and that folder is "C:/Users/<userid>/AppData/Roaming/FreeCAD/Macro", then use: |
|||
*** "localRoot": "C:/Users/<userid>/AppData/Roaming/FreeCAD/Macro", |
|||
*** "remoteRoot": "C:/Users/<userid>/AppData/Roaming/FreeCAD/Macro" |
|||
* If your macro can't find ptvsd despite having installed it somewhere precede 'import ptvsd' with |
|||
{{Code|code= |
|||
from sys import path |
|||
sys.path.append('/path/to/site-packages') |
|||
}} |
|||
Where the path is to the directory where ptvsd was installed. |
|||
* On the left bottom edge of VSCode you can choose the Python executable - it's best to make this the version packaged with FreeCAD. |
|||
In the Mac package it is /Applications/FreeCAD.App/Contents/Resources/bin/python. |
|||
You can locate it on your system by typing |
|||
{{Code|code= |
|||
import sys |
|||
print(sys.executable) |
|||
}} |
|||
into FreeCAD's Python console. |
|||
</div></div> <!-- END OF COLLAPSIBLE DIV --> |
</div></div> <!-- END OF COLLAPSIBLE DIV --> |
||
=== With LiClipse and AppImage === |
|||
<!-- START OF COLLAPSIBLE DIV --><div class="toccolours mw-collapsible mw-collapsed" style="width:800px;"> |
|||
LiClipse Debugging → |
|||
<div class="mw-collapsible-content"> |
|||
* Extract AppImage. |
|||
{{Code|code= |
|||
> ./your location/FreeCAD_xxx.AppImage --appimage-extract |
|||
> cd squashfs-root/ |
|||
}} |
|||
* The sqashfs-root location is where the debugger later on is hooked up to. |
|||
* Make sure you can start a FreeCAD session from within the squashfs-root location. |
|||
{{Code|code= |
|||
squashfs-root> ./usr/bin/freecadcmd |
|||
}} |
|||
* Should start up a FreeCAD commandline session. |
|||
* Install [https://www.liclipse.com/ LiClipse]. |
|||
** Comes ready with pydev and has installers for all platforms. |
|||
** For linux it is just to extract (to any location) and run. |
|||
* Configure liclipse for debugging. |
|||
** Right-click pydev icon (upper right corner) and choose customize. |
|||
*** Activate "PyDev Debug" (through checkbox, or it might be needed to go to tab "Action Set Availability" and activate there first). |
|||
*** In the pydev menu you can now choose "start debug server". |
|||
** Use menu window/open perspective/other > debug. |
|||
*** Right-click debug icon (upper right corner) and choose customize. |
|||
*** Checking "Debug" brings the debugging navigation tools to the toolbar. |
|||
** Open preferences through menu window/preferences. |
|||
*** In PyDev/Interpreters add "new Interpreter by browsing". |
|||
*** The added interpreter should be: {{incode|your loc/squashfs-root/usr/bin/python}}. |
|||
*** If you are only using this for fc, you can add AddOn workbench folders as well, or do that in a pydev-project later on. |
|||
* Find path to {{incode|pydevd.py}} in your liclipse installation. |
|||
** Something along the lines of: {{incode|your location/liclipse/plugins/org.python.pydev.xx/pysrc}}. |
|||
* Create a regular pydev-project in liclipse. |
|||
** Import external sources, for example a macro that you want to debug, or an external workbench. |
|||
** In that macro (or workbench .py file) add the code lines: |
|||
: {{Code|code= |
|||
import sys; sys.path.append("path ending with /pysrc") |
|||
import pydevd; pydevd.settrace() |
|||
}} |
|||
:* This is where the execution will halt when the macro is run. |
|||
* Start the liclipse debug server (menu pydev). |
|||
* Start FreeCAD. |
|||
{{Code|code= |
|||
squashfs-root> ./usr/bin/freecad |
|||
}} |
|||
* Run the macro (or any other file with a {{incode|pydevd.settrace()}} trigger) from within freecad, as you would normally do. |
|||
* Happy debugging. |
|||
* The use of LiClipse for remote debugging, and the steps described here related to liclipse, should work on any platform. The parts related to AppImage is for linux only. |
|||
</div></div> <!-- END OF COLLAPSIBLE DIV --> |
|||
=== Pyzo === |
|||
See the [[Pyzo|main article about Pyzo]]. |
|||
== Debugging OpenCasCade == |
|||
For developers needing to dig deeper in to the OpenCasCade kernel, user @abdullah has created a [https://forum.freecadweb.org/viewtopic.php?f=10&t=47017 thread] orientation discussing how to do so. |
|||
<div class="mw-translate-fuzzy"> |
|||
{{Docnav/ro |
{{Docnav/ro |
||
|[[Module Creation/ro|Module Creation]] |
|[[Module Creation/ro|Module Creation]] |
||
|[[Testing/ro|Testing]] |
|[[Testing/ro|Testing]] |
||
}} |
}} |
||
</div> |
|||
{{ |
{{Powerdocnavi{{#translation:}}}} |
||
[[Category:Developer Documentation{{#translation:}}]] |
[[Category:Developer Documentation{{#translation:}}]] |
||
[[Category:Python Code{{#translation:}}]] |
|||
{{clear}} |
Latest revision as of 10:12, 25 September 2023
Testează mai întâi
Înainte de a trece prin durerea de a depana utilizați Test framework pentru a verifica dacă testele standard funcționează corect. Dacă acestea nu se execută complet, este posibil să fie o instalare defectuoasă.
Before you go through the pain of debugging use the Test framework to check if the standard tests work properly. If they do not run complete there is possibly a broken installation.
Linie de Commandă
Depanarea debugging în FreeCAD este susținută de câteva mecanisme interne. Versiunea liniei de comandă a FreeCAD oferă câteva opțiuni pentru suportul de depanare.
The debugging of FreeCAD is supported by a few internal mechanisms. The command line version of FreeCAD provides some options for debugging support.
Acestea sunt opțiunile recunoscute curent în FreeCAD 0.15:
Generic options:
-v [ --version ] Prints version string -h [ --help ] Prints help message -c [ --console ] Starts in console mode --response-file arg Can be specified with '@name', too
Configuration:
-l [ --write-log ] Writes a log file to: $HOME/.FreeCAD/FreeCAD.log --log-file arg Unlike to --write-log this allows to log to an arbitrary file -u [ --user-cfg ] arg User config file to load/save user settings -s [ --system-cfg ] arg System config file to load/save system settings -t [ --run-test ] arg Test level -M [ --module-path ] arg Additional module paths -P [ --python-path ] arg Additional python paths
Generarea unei Backtrace
Dacă rulați o versiune experimentală de FreeCAD care este încă în curs de dezvoltare, aceasta poate "îngheța". Vă puteți ajuta să rezolvați astfel de probleme furnizând dezvoltatorilor o "backtrace". Pentru a face acest lucru, trebuie să executați o "Debug build" a software-ului. "Debug build" este un parametru care este setat în timpul compilării, deci va trebui fie să compilați FreeCAD dvs înșivă, fie să obțineți o versiune "debug" precompilată.
If you are running a version of FreeCAD from the bleeding edge of the development curve, it may "crash". You can help solve such problems by providing the developers with a "backtrace". To do this, you need to be running a "debug build" of the software. "Debug build" is a parameter that is set at compile time, so you'll either need to compile FreeCAD yourself, or obtain a pre-compiled "debug" version.
For Linux
Linux Debugging →
Prerequisites:
- varianta software de package gdb instalat
- o depanare a variantei compilate a FreeCAD (în acest moment disponibilă prin building from source)
- un model FreeCAD care a cauzat crash-ul
Pași: Introduceți următoarelor în fereastra terminalului dvs:
Find FreeCAD binary on your system:
$ whereis freecad
freecad: /usr/local/freecad <--- for example
$ cd /usr/local/freecad/bin
$ gdb FreeCAD
GNUdebugger will output some initializing information. The (gdb) shows GNUDebugger is running in the terminal, now input:
(gdb) handle SIG33 noprint nostop
(gdb) run
FreeCAD va porni. Efectuați pașii care determină ca FreeCAD să se prăbușească sau să înghețe, apoi introduceți în fereastra terminalului:
(gdb) bt
Aceasta va genera o listă lungă a exact ceea ce a făcut programul atunci când sa prăbușit sau a înghețat. Includeți acest lucru cu raportul problemei dvs.
(gdb) bt full
Print the values of the local variables also. This can be combined with a number to limit the number of frames shown.
For MacOSX
MacOSX Debugging →
Prerequisites:
- software package lldb installed
- a debug build of FreeCAD
- a FreeCAD model that causes a crash
Steps: Enter the following in your terminal window:
$ cd FreeCAD/bin
$ lldb FreeCAD
LLDB will output some initializing information. The (lldb) shows the debugger is running in the terminal, now input:
(lldb) run
FreeCAD va porni. Efectuați pașii care determină ca FreeCAD să se prăbușească sau să înghețe, apoi introduceți în fereastra terminalului:
(lldb) bt
Aceasta va genera o listă lungă a exact ceea ce a făcut programul atunci când sa prăbușit sau a înghețat. Includeți acest lucru cu raportul problemei dvs.
List Libraries Loaded by FreeCAD
(Applicable to Linux and macOS)
Sometimes it's helpful to understand what libraries FreeCAD is loading, specifically if there are multiple libraries being loaded of the same name but different versions (version collision). In order to see which libraries are loaded by FreeCAD when it crashes you should open a terminal and run it in the debugger. In a second terminal window, find out the process id of FreeCAD:
ps -A | grep FreeCAD
Use the returned id and pass it to lsof
:
lsof -p process_id
This prints a long list of loaded resources. So for example, if trying to ascertain if more than one Coin3d library versions is loaded, scroll through the list or search directly for Coin in the output:
lsof -p process_id | grep Coin
Python Debugging
Pentru o abordare mai modernă a depanării Python, cel puțin în Windows, a se vedea asta
For a more modern approach to debugging Python, see these posts:
- Debugging macros with VS 2017
- Python workbenches debugging
- python3.dll, Qt5Windgets.dll, Qt5Gui.dll and Qt5Core.dll not found
winpdb
winpdb Debugging →
Here is an example of using Winpdb inside FreeCAD:
Avem nevoie de depanatorul Python: Winpdb . Dacă nu aveți instalat, instalați-l sub Ubuntu / Debian cu:
sudo apt-get install winpdb
Acum permiteți configurarea programului de depanare.
- Start Winpdb.
- Set the debugger password to "test": Go to menu File->Password" and set the password.
Acum vom rula pas cu pas un script de testare Python în FreeCAD.
- Rulați winpdb și definiți password (e.g. test)
- Creați un fișier Python cu acest conținut
import rpdb2
rpdb2.start_embedded_debugger("test")
import FreeCAD
import Part
import Draft
print "hello"
print "hello"
import Draft
points=[FreeCAD.Vector(-3.0,-1.0,0.0),FreeCAD.Vector(-2.0,0.0,0.0)]
Draft.makeWire(points,closed=False,face=False,support=None)
- Dați Start la FreeCAD și încărcați fișierul de mai sus în FreeCAD
- Apăsați F6 ptru al-l executa
- Acum FreeCAD se va bloca (nu va răspunde) deoarece debuggerul Python este în așteptare
- Comutați pe Windpdb GUI și click on "Attach". După câteva secunde un articol "<Input>" apare acolo unde ați făcut dublu clic
- Acum Scriptul aflat în execuție curentă apare în Winpdb.
- Definiți o pauză la ultima linie și apăsați F5
- Acum apăsați F7 pentru a intra în codul Python al Draft.makeWire
Visual Studio Code (VS Code)
VS Code Debugging →
Prerequisites:
- The ptvsd package needs to be installed in a Python 3 outside of FreeCAD, then the module must be copied to FreeCAD's Python library folder.
# In a cmd window that has a path to you local Python 3:
pip install ptvsd
# Then if your Python is installed in C:\Users\<userid>\AppData\Local\Programs\Python\Python37
# and your FreeCAD is installed in C:\freecad\bin
xcopy "C:\Users\<userid>\AppData\Local\Programs\Python\Python37\Lib\site-packages\ptvsd" "C:\freecad\bin\Lib\site-packages\ptvsd"
Visual Studio Code documentation for remote debugging
Steps:
- Add following code at the beginning of your script
import ptvsd
print("Waiting for debugger attach")
# 5678 is the default attach port in the VS Code debug configurations
ptvsd.enable_attach(address=('localhost', 5678), redirect_output=True)
ptvsd.wait_for_attach()
- Add a debug configuration in Visual Studio Code Debug → Add Configurations….
- The config should look like this:
"configurations": [ { "name": "Python: Attacher", "type": "python", "request": "attach", "port": 5678, "host": "localhost", "pathMappings": [ { "localRoot": "${workspaceFolder}", "remoteRoot": "." } ] },
- In VS Code add a breakpoint anywhere you want.
- Launch the script in FreeCAD. FreeCAD freeze waiting for attachment.
- In VS Code start debugging using created configuration. You should see variables in debugger area.
- When setting breakpoints, VS Code will complain about not finding the .py file opened in the VS Code editor.
- Change "remoteRoot": "." to "remoteRoot": "<directory of file>"
- For example, if the Python file resides in /home/FC_myscripts/myscript.py
- Change to: "remoteRoot": "/home/FC_myscripts"
- If you're just debugging FreeCAD macros from the FreeCAD macro folder, and that folder is "C:/Users/<userid>/AppData/Roaming/FreeCAD/Macro", then use:
- "localRoot": "C:/Users/<userid>/AppData/Roaming/FreeCAD/Macro",
- "remoteRoot": "C:/Users/<userid>/AppData/Roaming/FreeCAD/Macro"
- Change "remoteRoot": "." to "remoteRoot": "<directory of file>"
- If your macro can't find ptvsd despite having installed it somewhere precede 'import ptvsd' with
from sys import path
sys.path.append('/path/to/site-packages')
Where the path is to the directory where ptvsd was installed.
- On the left bottom edge of VSCode you can choose the Python executable - it's best to make this the version packaged with FreeCAD.
In the Mac package it is /Applications/FreeCAD.App/Contents/Resources/bin/python.
You can locate it on your system by typing
import sys
print(sys.executable)
into FreeCAD's Python console.
With LiClipse and AppImage
LiClipse Debugging →
- Extract AppImage.
> ./your location/FreeCAD_xxx.AppImage --appimage-extract
> cd squashfs-root/
- The sqashfs-root location is where the debugger later on is hooked up to.
- Make sure you can start a FreeCAD session from within the squashfs-root location.
squashfs-root> ./usr/bin/freecadcmd
- Should start up a FreeCAD commandline session.
- Install LiClipse.
- Comes ready with pydev and has installers for all platforms.
- For linux it is just to extract (to any location) and run.
- Configure liclipse for debugging.
- Right-click pydev icon (upper right corner) and choose customize.
- Activate "PyDev Debug" (through checkbox, or it might be needed to go to tab "Action Set Availability" and activate there first).
- In the pydev menu you can now choose "start debug server".
- Use menu window/open perspective/other > debug.
- Right-click debug icon (upper right corner) and choose customize.
- Checking "Debug" brings the debugging navigation tools to the toolbar.
- Open preferences through menu window/preferences.
- In PyDev/Interpreters add "new Interpreter by browsing".
- The added interpreter should be:
your loc/squashfs-root/usr/bin/python
. - If you are only using this for fc, you can add AddOn workbench folders as well, or do that in a pydev-project later on.
- Right-click pydev icon (upper right corner) and choose customize.
- Find path to
pydevd.py
in your liclipse installation.- Something along the lines of:
your location/liclipse/plugins/org.python.pydev.xx/pysrc
.
- Something along the lines of:
- Create a regular pydev-project in liclipse.
- Import external sources, for example a macro that you want to debug, or an external workbench.
- In that macro (or workbench .py file) add the code lines:
import sys; sys.path.append("path ending with /pysrc") import pydevd; pydevd.settrace()
- This is where the execution will halt when the macro is run.
- Start the liclipse debug server (menu pydev).
- Start FreeCAD.
squashfs-root> ./usr/bin/freecad
- Run the macro (or any other file with a
pydevd.settrace()
trigger) from within freecad, as you would normally do.
- Happy debugging.
- The use of LiClipse for remote debugging, and the steps described here related to liclipse, should work on any platform. The parts related to AppImage is for linux only.
Pyzo
See the main article about Pyzo.
Debugging OpenCasCade
For developers needing to dig deeper in to the OpenCasCade kernel, user @abdullah has created a thread orientation discussing how to do so.
- FreeCAD scripting: Python, Introduction to Python, Python scripting tutorial, FreeCAD Scripting Basics
- Modules: Builtin modules, Units, Quantity
- Workbenches: Workbench creation, Gui Commands, Commands, Installing more workbenches
- Meshes and Parts: Mesh Scripting, Topological data scripting, Mesh to Part, PythonOCC
- Parametric objects: Scripted objects, Viewproviders (Custom icon in tree view)
- Scenegraph: Coin (Inventor) scenegraph, Pivy
- Graphical interface: Interface creation, Interface creation completely in Python (1, 2, 3, 4, 5), PySide, PySide examples beginner, intermediate, advanced
- Macros: Macros, How to install macros
- Embedding: Embedding FreeCAD, Embedding FreeCADGui
- Other: Expressions, Code snippets, Line drawing function, FreeCAD vector math library (deprecated)
- Hubs: User hub, Power users hub, Developer hub