Reputation: 948
Accordig to Python's official documentation at pdb:
You can also invoke pdb from the command line to debug other scripts. For example:
python -m pdb myscript.py
When invoked as a module, pdb will automatically enter post-mortem debugging if the program being debugged exits abnormally. After post-mortem debugging (or after normal exit of the program), pdb will restart the program. Automatic restarting preserves pdb’s state (such as breakpoints) and in most cases is more useful than quitting the debugger upon program’s exit.
Yet I need to run python -m pdb -c run myscript.py
or python -m pdb -c continue myscript.py
, otherwise pdb just enters the script and breaks at the first noncomment line.
I tested on RHEL 8, RHEL 9 and Fedora 40 with Python 3.12 and on SLES 15 SP3 wit Python 3.6.
Upvotes: 1
Views: 36