python / cpython

The Python programming language
https://www.python.org
Other
62.86k stars 30.11k forks source link

Pdb does not stop at a breakpoint after a restart command and source changes #59117

Open 490c593f-f636-409f-bb35-6abeb38a4595 opened 12 years ago

490c593f-f636-409f-bb35-6abeb38a4595 commented 12 years ago
BPO 14912
Nosy @asvetlov, @xdegaye

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields: ```python assignee = None closed_at = None created_at = labels = ['type-bug', 'library'] title = 'Pdb does not stop at a breakpoint after a restart command and source changes' updated_at = user = 'https://github.com/xdegaye' ``` bugs.python.org fields: ```python activity = actor = 'wipolun' assignee = 'none' closed = False closed_date = None closer = None components = ['Library (Lib)'] creation = creator = 'xdegaye' dependencies = [] files = [] hgrepos = [] issue_num = 14912 keywords = [] message_count = 4.0 messages = ['161567', '161575', '176272', '304611'] nosy_count = 3.0 nosy_names = ['asvetlov', 'xdegaye', 'wipolun'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'open' superseder = None type = 'behavior' url = 'https://bugs.python.org/issue14912' versions = ['Python 2.7', 'Python 3.2', 'Python 3.3'] ```

490c593f-f636-409f-bb35-6abeb38a4595 commented 12 years ago

In the following session, main.py is changed just before the restart command. Pdb does not stop at Breakpoint 1 after the last continue.

$ python -m pdb main.py
> /path_to/main.py(1)<module>()
-> def foo():
(Pdb) import sys; print(sys.version)
3.2.2 (default, Dec 27 2011, 17:35:55) 
[GCC 4.3.2]
(Pdb) break foo
Breakpoint 1 at /path_to/main.py:1
(Pdb) list
  1 B-> def foo():
  2         x = 1
  3         x = 2
  4
  5     foo()
[EOF]
(Pdb) continue
> /path_to/main.py(2)foo()
-> x = 1
(Pdb) restart
Restarting main.py with arguments:
        main.py
> /path_to/main.py(1)<module>()
-> def bar():
(Pdb) list
  1 B-> def bar():
  2         x = 1
  3         x = 2
  4
  5     def foo():
  6         bar()
  7
  8     foo()
[EOF]
(Pdb) continue
The program finished and will be restarted
> /path_to/main.py(1)<module>()
-> def bar():
(Pdb)
490c593f-f636-409f-bb35-6abeb38a4595 commented 12 years ago

Parsing the modules source seems a better way to fix this problem, see bpo-14913.

490c593f-f636-409f-bb35-6abeb38a4595 commented 11 years ago

See also how this is fixed at http://code.google.com/p/pdb-clone/source/detail?r=6ad576592286a005694690906644cb3004090eeb