Show More
@@ -724,6 +724,69 b' how to control where pdb will stop execution first.' | |||||
724 | For more information on the use of the pdb debugger, see :ref:`debugger-commands` |
|
724 | For more information on the use of the pdb debugger, see :ref:`debugger-commands` | |
725 | in the Python documentation. |
|
725 | in the Python documentation. | |
726 |
|
726 | |||
|
727 | IPython extends the debugger with a few useful additions, like coloring of | |||
|
728 | tracebacks. The debugger will adopt the color scheme selected for IPython. | |||
|
729 | ||||
|
730 | The ``where`` command has also been extended to take as argument the number of | |||
|
731 | context line to show. This allows to a many line of context on shallow stack trace: | |||
|
732 | ||||
|
733 | .. code:: | |||
|
734 | In [5]: def foo(x): | |||
|
735 | ...: 1 | |||
|
736 | ...: 2 | |||
|
737 | ...: 3 | |||
|
738 | ...: return 1/x+foo(x-1) | |||
|
739 | ...: 5 | |||
|
740 | ...: 6 | |||
|
741 | ...: 7 | |||
|
742 | ...: | |||
|
743 | ||||
|
744 | In[6]: foo(1) | |||
|
745 | # ... | |||
|
746 | ipdb> where 8 | |||
|
747 | <ipython-input-6-9e45007b2b59>(1)<module>() | |||
|
748 | ----> 1 foo(1) | |||
|
749 | ||||
|
750 | <ipython-input-5-7baadc3d1465>(5)foo() | |||
|
751 | 1 def foo(x): | |||
|
752 | 2 1 | |||
|
753 | 3 2 | |||
|
754 | 4 3 | |||
|
755 | ----> 5 return 1/x+foo(x-1) | |||
|
756 | 6 5 | |||
|
757 | 7 6 | |||
|
758 | 8 7 | |||
|
759 | ||||
|
760 | > <ipython-input-5-7baadc3d1465>(5)foo() | |||
|
761 | 1 def foo(x): | |||
|
762 | 2 1 | |||
|
763 | 3 2 | |||
|
764 | 4 3 | |||
|
765 | ----> 5 return 1/x+foo(x-1) | |||
|
766 | 6 5 | |||
|
767 | 7 6 | |||
|
768 | 8 7 | |||
|
769 | ||||
|
770 | ||||
|
771 | And less context on shallower Stack Trace: | |||
|
772 | ||||
|
773 | .. code:: | |||
|
774 | ipdb> where 1 | |||
|
775 | <ipython-input-13-afa180a57233>(1)<module>() | |||
|
776 | ----> 1 foo(7) | |||
|
777 | ||||
|
778 | <ipython-input-5-7baadc3d1465>(5)foo() | |||
|
779 | ----> 5 return 1/x+foo(x-1) | |||
|
780 | ||||
|
781 | <ipython-input-5-7baadc3d1465>(5)foo() | |||
|
782 | ----> 5 return 1/x+foo(x-1) | |||
|
783 | ||||
|
784 | <ipython-input-5-7baadc3d1465>(5)foo() | |||
|
785 | ----> 5 return 1/x+foo(x-1) | |||
|
786 | ||||
|
787 | <ipython-input-5-7baadc3d1465>(5)foo() | |||
|
788 | ----> 5 return 1/x+foo(x-1) | |||
|
789 | ||||
727 |
|
790 | |||
728 | Post-mortem debugging |
|
791 | Post-mortem debugging | |
729 | --------------------- |
|
792 | --------------------- |
General Comments 0
You need to be logged in to leave comments.
Login now