-
Notifications
You must be signed in to change notification settings - Fork 230
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
running set_trace() multiple times displays stdlib bdb.py #52
Comments
This seems to only happen with a breakpoint defined. |
Can't reproduce this with Python 2.7, Urwid 1.0.1, Pudb from git. |
Ah, only just saw your comment on breakpoints. I've reproduced this and will look into it. |
FYI--I'm currently applying for jobs and don't have a ton of time, so if you've got time to look into this and send a patch, I'd much appreciate it. (Same goes for the other bug.) |
I've fixed the breakpoint doubling in git. That was a silly, unrelated thing. |
I don't think this has anything to do with having saved breakpoints. |
@asmeurer Correct. You don't need saved breakpoints to reproduce this. Just debug with pudb and try to step (or continue) past a set_trace, and you'll be dropped into bdb.py. It seems to me that there must be something that blacklists pudb code as being "not part of the code", but it neglected to include working for these few lines of bdb.py. Incidentally, this hypothetical blacklisting functionality makes it hard / impossible to debug pudb using pudb. |
As noted at #63, this also happens with the new Regarding debugging PuDB with PuDB, yeah, there probably aren't very many debuggers that can debug themselves. Quis custodiet ipsos custodes? and all that. The real issue in my experience is just the fact that it runs a terminal GUI. Also, it eats up stdout (or at least hides it), so print statements are worthless. If you find yourself needing to debug PuDB, see http://lists.tiker.net/pipermail/pudb/2011-August/000039.html. |
It does have something to do with breakpoints. Without any breakpoints, this issue does not occur. That said, it's not likely to be bdb's fault, since pdb doesn't have this issue. |
I deleted my breakpoints file and this still happens. |
As in, you had no breakpoints at all set, did not set any new ones, and you still ended up in bdb? That's not what I'm seeing. Without breakpoints, everything is fine for me. |
Yes. I even completely removed |
As in, from a completely clean slate, you run
then hit |
It's a few from pudb import set_trace
set_trace() which I guess is technically a different code path (but it doesn't matter in this case; starting PuDB from set_trace or from pudb.run both go to bdb if set_trace is hit while debugging). |
This script reproduces the issue. I noticed you have to press
|
This patch works around the issue. Apparently there's some leftover state in the cached Debugger that is causing this behavior.
|
I can reproduce the issue in pdb with this:
|
patching stdlib bdb.py in this way fixes the issue (and stdlib unit tests continue to pass). You might put this into pudb as a method override for now, and see if anything untoward happens. If not, it's a fair argument for upstreaming. diff -r ef8ea052bcc4 Lib/bdb.py
--- a/Lib/bdb.py Sun Mar 17 22:06:18 2013 -0400
+++ b/Lib/bdb.py Mon Mar 18 15:06:04 2013 -0700
@@ -212,15 +212,14 @@
def set_trace(self, frame=None):
"""Start debugging from `frame`.
If frame is not specified, debugging starts from caller's frame.
"""
if frame is None:
frame = sys._getframe().f_back
- self.reset()
while frame:
frame.f_trace = self.trace_dispatch
self.botframe = frame
frame = frame.f_back
self.set_step()
sys.settrace(self.trace_dispatch)
|
#67 was merged. |
Reproduction steps:
python foobar.py foo bar
foo
foobar.py:11
(the first line ofmain()
:for arg in argv:
)/usr/lib/python2.6/bdb.py
at_ste_stopinfo()
, and also see that you now have two breakpoints atfoobar.py:11
s
fourteen times eventually brings you to the correct breakpoint inbar()
The expected behavior is to not display bdb.py, and not create duplicate breakpoints.
Obviously there are other ways to accomplish the desired debugging session, but in a large, complex code base, it is sometimes extremely convenient to have multiple set_trace lines, which may or may not cause set_trace to be called twice.
If you can tell me how to induce this error automatically, I can write a unit test for it, at minimum, and likely produce a patch for the bug as well.
The text was updated successfully, but these errors were encountered: