Import statement
import pdb; pdb.set_trace()| Command | Action | Brief Explanation |
|---|---|---|
l (list) |
Show Code | Shows 11 lines of code around your current position. |
ll (long list) |
Show Function | Shows the entire source code for the current function. |
n (next) |
Step Over | Executes current line; stops at the next line in the same function. |
s (step) |
Step Into | Follows execution inside a called function. |
c (continue) |
Play | Resumes program execution until the next breakpoint. |
r (return) |
Step Out | Runs until the current function returns to its caller. |
p <var> |
Evaluates and prints a variable (e.g., p user_id). |
|
pp <var> |
Pretty Print | Formats dicts/lists/JSON into a readable tree structure. |
w (where) |
Stack Trace | Shows the call stack (how you got to this specific line). |
u (up) / d (down) |
Move Stack | Move Up to the caller or Down toward the current line. |
b <line> |
Set Breakpoint | Create a stop point at a line number (e.g., b 42). |
b <line>, <cond> |
Conditional Break | Only stop if condition is true (e.g., b 42, i > 10). |
cl (clear) |
Clear Break | Deletes a breakpoint (e.g., cl 1 to remove breakpoint #1). |
j <line> |
Jump | Time Travel: Skips ahead or goes back to re-run a line. |
unt <line> |
Until | Runs until the execution reaches a line number higher than current. |
sticky |
Sticky Mode | (Python 3.13+) Keeps code visible at the top while you step. |
q (quit) |
Exit | Immediately kills the debugger and the script. |