python / python/cpython

remote pdb can not attach when breakpoint() and exit

Open
#139,688 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stdlib type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Bug report

Bug description:

reproduce

on terminal

./python.exe
breakpoint()
# ctrl + D

another terminal

sudo ./python.exe -m pdb -p $(pid)

more can check png below
Image

Image

debug:

Pdb._last_pdb_instance still when do_quit in repl so remote pdb can not exec in it

fix:

diff --git a/Lib/pdb.py b/Lib/pdb.py
index f695a39332..3e32c50f96 100644
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -2008,6 +2008,7 @@ def do_quit(self, arg):
                     return
 
         self._user_requested_quit = True
+        Pdb._last_pdb_instance = None
         self.set_quit()
         return 1
 

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs
  • gh-139690

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Lib/pdb.py at Pdb.do_quit and reproduce the breakpoint() and exit sequence from the issue before reviewing the proposed change. Verify that quitting the local debugger permits a later remote pdb attach, and check the linked PR gh-139690 for work already underway.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.