Python pdb

From wikinotes
Revision as of 20:24, 8 February 2019 by Will (talk | contribs) (→‎Commands)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

pdb is python's official builtin debugger. It lets you step through your code line-by-line, testing values until you find a problem.

Usage

Commands

l list current position
bt print backtrace at current position
c continue to next line (do not recurse into called)
s step into current line (recurse into it)
enter repeat last command
h print help menu

launch from cli

python  -m pdb  test.py

launch from src

import pdb;pdb.set_trace()