New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
on terminating, Pdb debugs itself #58948
Comments
All the problems raised in this issue are caused by self.botframe In the following pdb session run with python 3.2.2, the first two i = 1 ================================================= $ python3 -m pdb foo.py
> path_to/foo.py(1)<module>()
-> i = 1
(Pdb) import sys; print(sys.version)
3.2.2 (default, Dec 27 2011, 17:35:55)
[GCC 4.3.2]
(Pdb) where
/usr/local/lib/python3.2/bdb.py(392)run()
-> exec(cmd, globals, locals)
<string>(1)<module>()
> path_to/foo.py(1)<module>()
-> i = 1
(Pdb) step
--Return--
> path_to/foo.py(1)<module>()->None
-> i = 1
(Pdb) step
--Return--
> <string>(1)<module>()->None
(Pdb) step
The program finished and will be restarted
> path_to/foo.py(1)<module>()
-> i = 1
(Pdb) quit ================================================= In the following pdb session run with python built from the default i = 1 ================================================= $ python -m pdb foo.py
> path_to/foo.py(1)<module>()
-> i = 1
(Pdb) step
--Return--
> path_to/foo.py(1)<module>()->None
-> i = 1
(Pdb) step
--Return--
> <string>(1)<module>()->None
(Pdb) step
> path_to/cpython/Lib/bdb.py(409)run()
-> self.quitting = True
(Pdb) quit
Traceback (most recent call last):
File "path_to/cpython/Lib/pdb.py", line 1651, in main
pdb._runscript(mainpyfile)
File "path_to/cpython/Lib/pdb.py", line 1532, in _runscript
self.run(statement)
File "path_to/cpython/Lib/bdb.py", line 409, in run
self.quitting = True
File "path_to/cpython/Lib/bdb.py", line 409, in run
self.quitting = True
File "path_to/cpython/Lib/bdb.py", line 47, in trace_dispatch
return self.dispatch_line(frame)
File "path_to/cpython/Lib/bdb.py", line 66, in dispatch_line
if self.quitting: raise BdbQuit
bdb.BdbQuit
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> path_to/cpython/Lib/bdb.py(66)dispatch_line()
-> if self.quitting: raise BdbQuit
(Pdb) quit
Post mortem debugger finished. The foo.py will be restarted
> path_to/foo.py(1)<module>()
-> i = 1
(Pdb) quit ================================================= In the following pdb session run with python 3.2.2, the session is import time
i = 1
while i:
time.sleep(.100)
i = 0 ================================================= $ python3 -m pdb foo.py
> path_to/foo.py(1)<module>()
-> import time
(Pdb) import sys; print(sys.version)
3.2.2 (default, Dec 27 2011, 17:35:55)
[GCC 4.3.2]
(Pdb) continue
^C
Program interrupted. (Use 'cont' to resume).
> path_to/foo.py(3)<module>()
-> while i:
(Pdb) !i=0
(Pdb) step
> path_to/foo.py(5)<module>()
-> i = 0
(Pdb) step
--Return--
> path_to/foo.py(5)<module>()->None
-> i = 0
(Pdb) step
--Return--
> <string>(1)<module>()->None
(Pdb) step
> /usr/local/lib/python3.2/bdb.py(396)run()
-> self.quitting = True
(Pdb) quit
Traceback (most recent call last):
File "/usr/local/lib/python3.2/pdb.py", line 1556, in main
pdb._runscript(mainpyfile)
File "/usr/local/lib/python3.2/pdb.py", line 1437, in _runscript
self.run(statement)
File "/usr/local/lib/python3.2/bdb.py", line 396, in run
self.quitting = True
File "/usr/local/lib/python3.2/bdb.py", line 396, in run
self.quitting = True
File "/usr/local/lib/python3.2/bdb.py", line 46, in trace_dispatch
return self.dispatch_line(frame)
File "/usr/local/lib/python3.2/bdb.py", line 65, in dispatch_line
if self.quitting: raise BdbQuit
bdb.BdbQuit
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /usr/local/lib/python3.2/bdb.py(65)dispatch_line()
-> if self.quitting: raise BdbQuit
(Pdb) quit
Post mortem debugger finished. The foo.py will be restarted
> path_to/foo.py(1)<module>()
-> import time
(Pdb) quit ================================================= The attached patch fixes all those problems. The patch applies to the |
Uploaded a new patch, pdb_botframe_default_2.patch (that applies to
|
The previous patch only fixed the problem when the debugger is started This patch also corrects pdb.runcall(): in the following session, the === main.py ================================= import pdb, sys
print(sys.version)
def foo():
pass
pdb.runcall(foo) ================================================= $ python3.1 main.py
3.1.2 (r312:79147, Apr 4 2010, 17:46:48)
[GCC 4.3.2]
> /path_to/main.py(5)foo()
-> pass
(Pdb) quit ================================================= |
See also how this is fixed at |
Can we have a formal patch review please, but note the similar patch on bpo-14788. |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: