Debugging/ru: Difference between revisions

From FreeCAD Documentation
mNo edit summary
(Updating to match new version of source page)
Line 1: Line 1:
== Test first ==
== Певые испытания ==
Before you go through the pain of debugging use the test framework to check if the standard tests work properly. If not there is maybe a broken installation.


== command line ==
Перед тем как пройти через боль от процесса отладки , используйте набор для тестирования(тестовый модуль), чтобы проверить будут ли работать стандартные тесты должным образом. Если нет, то возможно дело, поломанной(нарушенной) установке.
The ''debugging'' of FreeCAD is supported by a few internal mechanisms. The command line version of FreeCAD provides to options for debugging support:
;-v: With the "v" option FreeCAD gives a more verbose output.
;-l: With the "l" option FreeCAD writes additional information to a logfile.




== 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.


=== For Linux ===
''Отладка'' FreeCAD поддерживает несколько внутренних механизмов. Версия FreeCAD без графического режима предоставляет варианты поддержки отладки:
Prerequisites:
;-v: С "v" опцией FreeCAD дает более подробный вывод
;-l: С "l" опцией FreeCAD записывает дополнительную информацию в лог-файл.


* software package gdb installed
{{Docnav|Module Creation/ru|Testing/ru}}
* a debug build of FreeCAD
* a FreeCAD model that causes a crash


Steps:
{{languages/ru | {{en|Debugging}} {{es|Debugging/es}} {{fr|Debugging/fr}} {{se|Debugging/se}} }}
Enter the following in your terminal window:
<syntaxhighlight>
cd FreeCAD/bin
gdb FreeCAD
handle SIG33 noprint nostop
run
</syntaxhighlight>
FreeCAD will now start up. Perform the steps that cause FreeCAD to crash, then enter 'bt' in your terminal window. This will generate a lengthy listing of exactly what the program was doing when it crash. Include this with your problem report.


== Python debugging ==
[[Category:Developer Documentation/ru]]
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
<syntaxhighlight>
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)
</syntaxhighlight>
# 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

{{Docnav|Module Creation|Testing}}

[[Category:Developer Documentation]]

{{clear}}
<languages/>

Revision as of 20:51, 14 October 2014

Test first

Before you go through the pain of debugging use the test framework to check if the standard tests work properly. If not there is maybe a broken installation.

command line

The debugging of FreeCAD is supported by a few internal mechanisms. The command line version of FreeCAD provides to options for debugging support:

-v
With the "v" option FreeCAD gives a more verbose output.
-l
With the "l" option FreeCAD writes additional information to a logfile.


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.

For Linux

Prerequisites:

  • 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
 handle SIG33 noprint nostop
 run

FreeCAD will now start up. Perform the steps that cause FreeCAD to crash, then enter 'bt' in your terminal window. This will generate a lengthy listing of exactly what the program was doing when it crash. Include this with your problem report.

Python debugging

Here is an example of using winpdb inside FreeCAD:

  1. Run winpdb and set the password (e.g. test)
  2. 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)
  1. Start FreeCAD and load the above file into FreeCAD
  2. Press F6 to execute it
  3. Now FreeCAD will become unresponsive because the Python debugger is waiting
  4. Switch to the Windpdb GUI and click on "Attach". After a few seconds an item "<Input>" appears where you have to double-click
  5. Now the currently executed script appears in Winpdb.
  6. Set a break at the last line and press F5
  7. Now press F7 to step into the Python code of Draft.makeWire
Module Creation
Testing