Add commands to a breakpoint in .pdbrc

Viewed 51

Is it possible to specify commands for a breakpoint in a .pdbrc file?

I tried this in my .pdbrc:

break myscript.py:1
commands 1
!print('hello, world!')
continue

But when I run python -m pdb myscript.py, I am prompted to enter the commands interactively, instead of them being set from .pdbrc:

>>> python -m pdb myscript.py
Breakpoint 1 at myscript.py:1
(com)

Only after I enter the commands does pdb finish executing the .pdbrc:

(com) continue
hello, world!
# Script runs

Obviously this severely constrains what kind of automated debugging setup is possible with the .pdbrc file. Is there a solution?

0 Answers
Related