Difference between revisions of "Debugging/ro"
(Created page with "Debugging")
(Created page with "Category:Developer Documentation/ro")
|Line 78:||Line 78:|
Revision as of 15:18, 27 February 2016
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.
The debugging of FreeCAD is supported by a few internal mechanisms. The command line version of FreeCAD provides some options for debugging support.
These are the currently recognized options in FreeCAD 0.15:
-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
-l [ --write-log ] Writes a log file to: /home/graphos/.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 Systen 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
Generating a Backtrace
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.
- software package gdb installed
- a debug build of FreeCAD
- a FreeCAD model that causes a crash
Steps: Enter the following in your terminal window:
$ cd 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 will now start up. Perform the steps that cause FreeCAD to crash or freeze, then enter in the terminal window:
This will generate a lengthy listing of exactly what the program was doing when it crashed or froze. Include this with your problem report.
Here is an example of using winpdb inside FreeCAD:
- Run winpdb and set the password (e.g. test)
- Create a Python file with this content
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)
- Start FreeCAD and load the above file into FreeCAD
- Press F6 to execute it
- Now FreeCAD will become unresponsive because the Python debugger is waiting
- Switch to the Windpdb GUI and click on "Attach". After a few seconds an item "<Input>" appears where you have to double-click
- Now the currently executed script appears in Winpdb.
- Set a break at the last line and press F5
- Now press F7 to step into the Python code of Draft.makeWire