@@ -99,7 +99,9 @@ PEP 768: Safe external debugger interface for CPython
99
99
100
100
:pep: `768 ` introduces a zero-overhead debugging interface that allows debuggers and profilers
101
101
to safely attach to running Python processes. This is a significant enhancement to Python's
102
- debugging capabilities allowing debuggers to forego unsafe alternatives.
102
+ debugging capabilities allowing debuggers to forego unsafe alternatives. See
103
+ :ref: `below <whatsnew314-remote-pdb >` for how this feature is leveraged to
104
+ implement the new :mod: `pdb ` module's remote attaching capabilities.
103
105
104
106
The new interface provides safe execution points for attaching debugger code without modifying
105
107
the interpreter's normal execution path or adding runtime overhead. This enables tools to
@@ -149,6 +151,32 @@ See :pep:`768` for more details.
149
151
150
152
(Contributed by Pablo Galindo Salgado, Matt Wozniski, and Ivona Stojanovic in :gh: `131591 `.)
151
153
154
+
155
+ .. _whatsnew314-remote-pdb :
156
+
157
+ Remote attaching to a running Python process with PDB
158
+ -----------------------------------------------------
159
+
160
+ The :mod: `pdb ` module now supports remote attaching to a running Python process
161
+ using a new ``-p PID `` command-line option:
162
+
163
+ .. code-block :: sh
164
+
165
+ python -m pdb -p 1234
166
+
167
+ This will connect to the Python process with the given PID and allow you to
168
+ debug it interactively. Notice that due to how the Python interpreter works
169
+ attaching to a remote process that is blocked in a system call or waiting for
170
+ I/O will only work once the next bytecode instruction is executed or when the
171
+ process receives a signal.
172
+
173
+ This feature leverages :pep: `768 ` and the :func: `sys.remote_exec ` function
174
+ to attach to the remote process and send the PDB commands to it.
175
+
176
+
177
+ (Contributed by Matt Wozniski and Pablo Galindo in :gh: `131591 `.)
178
+
179
+
152
180
.. _whatsnew314-pep758 :
153
181
154
182
PEP 758 – Allow except and except* expressions without parentheses
0 commit comments