.. _debugger: :mod:`pdb` --- The Python Debugger
================================== .. module:: pdb :synopsis:
The Python debugger for interactive interpreters. .. index::
single: debugging The module :mod:`pdb` defines an interactive
source code debugger for Python programs. It supports setting
(conditional) breakpoints and single stepping at the source line
level, inspection of stack frames, source code listing, and
evaluation of arbitrary Python code in the context of any stack
frame. It also supports post-mortem debugging and can be called
under program control. .. index:: single: Pdb (class in pdb)
module: bdb module: cmd The debugger is extensible -- it is
actually defined as the class :class:`Pdb`. This is currently
undocumented but easily understood by reading the source. The
extension interface uses the modules :mod:`bdb` and :mod:`cmd`.
The debugger's prompt is ``(Pdb)``. Typical usage to run a
program under control of the debugger is:: >>> import pdb >>>
import mymodule >>> pdb.run('mymodule.test()