I find there are two ways to invoke pdb.
In OS's shell, run
pdb myscript.py
, which invokes pdb immediately and allows to run pdb commands on the running ofmyscript.py
.in
myscript.py
, import pdb module, and add some function from pdb module inmyscript.py
. Then runmyscript.py
without pdb aspython myscript.py
, and when the running ofmyscript.py
reaches the first pdb function inmyscript.py
, pdb will be invoked, which allows to run pdb commands on the running ofmyscript.py
.
My questions are:
Are the pdb script (run in a shell in the first way) and the pdb module (imported into
myscript.py
in the second way) both in the same scriptpdb.py
?In the second way, how is pdb invoked when running a debugged program till a function from pdb module, so that the two ways look the same after invoking pdb?