Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb0bf48a

Browse files
[3.14] Add documentation for remote debugging with pdb (GH-134260) (#134398)
1 parent64047f7 commitb0bf48a

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

‎Doc/library/pdb.rst

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ The debugger's prompt is ``(Pdb)``, which is the indicator that you are in debug
8080
You can also invoke:mod:`pdb` from the command line to debug other scripts. For
8181
example::
8282

83-
python -m pdb [-c command] (-m module | pyfile) [args ...]
83+
python -m pdb [-c command] (-m module |-p pid |pyfile) [args ...]
8484

8585
When invoked as a module, pdb will automatically enter post-mortem debugging if
8686
the program being debugged exits abnormally. After post-mortem debugging (or
@@ -104,6 +104,24 @@ useful than quitting the debugger upon program's exit.
104104
..versionchanged::3.7
105105
Added the ``-m`` option.
106106

107+
..option::-p,--pid <pid>
108+
109+
Attach to the process with the specified PID.
110+
111+
..versionadded::3.14
112+
113+
114+
To attach to a running Python process for remote debugging, use the ``-p`` or
115+
``--pid`` option with the target process's PID::
116+
117+
python -m pdb -p 1234
118+
119+
..note::
120+
121+
Attaching to a process that is blocked in a system call or waiting for I/O
122+
will only work once the next bytecode instruction is executed or when the
123+
process receives a signal.
124+
107125
Typical usage to execute a statement under control of the debugger is::
108126

109127
>>> import pdb

‎Lib/pdb.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3490,7 +3490,8 @@ def help():
34903490
_usage="""\
34913491
Debug the Python program given by pyfile. Alternatively,
34923492
an executable module or package to debug can be specified using
3493-
the -m switch.
3493+
the -m switch. You can also attach to a running Python process
3494+
using the -p option with its PID.
34943495
34953496
Initial commands are read from .pdbrc files in your home directory
34963497
and in the current directory, if they exist. Commands supplied with

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp