From 1079ebc17f720557c2e53f765aef52f36286a71b Mon Sep 17 00:00:00 2001 From: donBarbos Date: Sun, 9 Mar 2025 05:55:03 +0400 Subject: [PATCH 1/3] use `.. program::` directive for documenting `pdb` CLI --- Doc/library/pdb.rst | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst index b31625e6b0082f..9be7be52e2fb79 100644 --- a/Doc/library/pdb.rst +++ b/Doc/library/pdb.rst @@ -75,10 +75,14 @@ The debugger's prompt is ``(Pdb)``, which is the indicator that you are in debug arguments of the ``p`` command. +.. program:: pdb + You can also invoke :mod:`pdb` from the command line to debug other scripts. For -example:: +example: + +.. code-block:: bash - python -m pdb myscript.py + python -m pdb [-h] [-c command] (-m module | pyfile) [args ...] When invoked as a module, pdb will automatically enter post-mortem debugging if the program being debugged exits abnormally. After post-mortem debugging (or @@ -86,14 +90,21 @@ 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. -.. versionchanged:: 3.2 - Added the ``-c`` option to execute commands as if given - in a :file:`.pdbrc` file; see :ref:`debugger-commands`. +.. option:: -c, --command -.. versionchanged:: 3.7 - Added the ``-m`` option to execute modules similar to the way - ``python -m`` does. As with a script, the debugger will pause execution just - before the first line of the module. + To execute commands as if given in a :file:`.pdbrc` file; see + :ref:`debugger-commands`. + + .. versionchanged:: 3.2 + Added the ``-c`` option. + +.. option:: -m + + To execute modules similar to the way ``python -m`` does. As with a script, + the debugger will pause execution just before the first line of the module. + + .. versionchanged:: 3.7 + Added the ``-m`` option. Typical usage to execute a statement under control of the debugger is:: From a0384dbcd97440685b1ff04e6d861864d22a7f23 Mon Sep 17 00:00:00 2001 From: donBarbos Date: Sun, 9 Mar 2025 06:19:43 +0400 Subject: [PATCH 2/3] Update pdb.rst Co-authored-by: Tian Gao --- Doc/library/pdb.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst index 9be7be52e2fb79..4a303fa0a071d8 100644 --- a/Doc/library/pdb.rst +++ b/Doc/library/pdb.rst @@ -82,7 +82,7 @@ example: .. code-block:: bash - python -m pdb [-h] [-c command] (-m module | pyfile) [args ...] + python -m pdb [-c command] (-m module | pyfile) [args ...] When invoked as a module, pdb will automatically enter post-mortem debugging if the program being debugged exits abnormally. After post-mortem debugging (or From 53cfedaf11a2d60e0e42cbc5f8861c27cb1c5242 Mon Sep 17 00:00:00 2001 From: donBarbos Date: Sun, 9 Mar 2025 17:39:07 +0400 Subject: [PATCH 3/3] Update pdb.rst --- Doc/library/pdb.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst index 4a303fa0a071d8..1c92398677d048 100644 --- a/Doc/library/pdb.rst +++ b/Doc/library/pdb.rst @@ -78,9 +78,7 @@ The debugger's prompt is ``(Pdb)``, which is the indicator that you are in debug .. program:: pdb You can also invoke :mod:`pdb` from the command line to debug other scripts. For -example: - -.. code-block:: bash +example:: python -m pdb [-c command] (-m module | pyfile) [args ...]