Skip to content

Commit dbaaa18

Browse files
chenneshyarion
authored andcommitted
Update debugging info to reflect recent CLion updates
1 parent f5a08e2 commit dbaaa18

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

gettingstarted/CLion.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ Use the Run or Debug Icons from the top bar shown in the prior image.
5656

5757
## Debugging
5858

59-
*note* This depends on https://github.com/FreeCAD/FreeCAD/pull/16850 getting merged!
60-
6159
While CLion supports both a C++ debugger and a Python debugger, it generally does not support
6260
embedded Python interpreters, nor debugging both simultaneously. However, there are workaround
6361
procedures that will allow this.
@@ -97,30 +95,31 @@ Simply choose the debug option to start FreeCAD, and you're good to go.
9795

9896
### Setting up for python debugging in CLion
9997

100-
Install pydevd in the interpreter that FreeCAD is using. 'pip3 install pydevd' from the correct
101-
venv is one way to accomplish this.
102-
10398
Use the settings button in the upper right, the File Menu -> Settings, or the Ctrl-Alt-S shortcut
10499
to open the settings dialog, expand the Build, Execution, Deployment tree item, and select a Python
105100
Interpreter:
106101

107102
![Pict1](./resources/CLionPythonDebug1.png)
108103

104+
Install `pydevd` into the FreeCAD python environment, if it is not already present. For example,
105+
```
106+
C:\Users\jdoe\FreeCAD\cmake-build-relwithdebinfo-visual-studio\bin\python.exe -m pip install pydevd
107+
```
109108
Switch to the Python Debugger settings, and change the Attach To Process name from python to 'Freecad'
110109
You may need to change this back if you use the IDE for other applications.
111110

112111
![Pict2](./resources/CLionPythonDebug2.png)
113112

114113
Now there are three approaches here:
115-
1. Wait for CLion 2024.3 which is supposed to have a static port listener option with a
116-
configurable port available in the 'Python Debugger' pane of the CMake profile you use.
117-
[see context](https://youtrack.jetbrains.com/issue/CPP-5797/Cross-debugging-Python-and-C#focus=Comments-27-10655987.0-0)
118-
and [see planned fix.](https://youtrack.jetbrains.com/issue/PY-21325/Add-an-ability-to-specify-debugger-port) Port should be 5679 if you use the macro below.
119-
2. Find the attach_pydevd.py file in your CLion installation, and modify it using the
114+
1. Using a recent version of CLion (at least 2024.3), ensure that the `python.debug.use.single.port` is checked in
115+
CLion's Registry (Help->Find action...->"Registry"), then in the Python Debugger settings page set the port to 5679.
116+
Note that this option will not appear if your registry setting is off (the default starting in 2024.3.1), so
117+
if you don't see the option to set the port, go back and double-check the registry setting.
118+
3. Find the attach_pydevd.py file in your CLion installation, and modify it using the
120119
contrib/clion/attach_pydevd.py.patch in the source code. Then use the macro below.
121-
3. Use this elaborate work around:
120+
4. Use this elaborate work around:
122121

123-
### Running a python or simultaneous debug using the non intrusive procedure
122+
### Running a python or simultaneous debug using the non-intrusive procedure
124123

125124
1. You can start your FreeCAD independently, via CLion, or in c++ debug mode under CLion.
126125

0 commit comments

Comments
 (0)