bpo-24160: Fix breakpoints persistence across multiple pdb sessions#21989
bpo-24160: Fix breakpoints persistence across multiple pdb sessions#21989gvanrossum merged 9 commits into
Conversation
|
I would have gone the other way with this, and made the breakpoints for different Bdb instances completely independent, rather than completely dependent, but this works too. |
Sorry, something went wrong.
|
That was my first thought as well, but then I realised it would be annoying to have to set the same breakpoints again and again while debugging something. (It’s easy to do ‘clear’ if that’s what you want). |
Sorry, something went wrong.
fb6cac6 to
74c6560
Compare
August 28, 2020 23:00
taleinat
left a comment
There was a problem hiding this comment.
If possible, I think it would be god for the new tests to be slightly expanded to also include deleting breakpoints.
Sorry, something went wrong.
taleinat
left a comment
There was a problem hiding this comment.
Perhaps now Bdb.clear_all_breaks() should use the new clearBreakpoints internally?
Sorry, something went wrong.
I don't see any tests for deleting breakpoint, and indeed coverage seems pretty grim: |
Sorry, something went wrong.
I think this could break something if some Bdb subclass changes the way this data is represented. |
Sorry, something went wrong.
|
It's messy because this class level state is accessed through self. |
Sorry, something went wrong.
True, let's leave it as is for now. |
Sorry, something went wrong.
|
Random question: Maybe someone knows how "lineno" came to be shorthand for "line number"?? |
Sorry, something went wrong.
|
@iritkatriel, this is looking good. I'll make a final review later and likely approve. |
Sorry, something went wrong.
I asked google and it said something about Lenin. |
Sorry, something went wrong.
|
This looks like a feature, let's not backport it. |
Sorry, something went wrong.
|
Shall we try to get this into 3.10? |
Sorry, something went wrong.
|
SGTM. Is it ready? I haven't reviewed it yet. |
Sorry, something went wrong.
|
I've just rebased it. I think it is ready to merge. @taleinat had reviewed it a while back and we made some improvements. |
Sorry, something went wrong.
gvanrossum
left a comment
There was a problem hiding this comment.
Okay, from a cursory inspection looks good. I trust @taleinat.
Sorry, something went wrong.
The information about breakpoints is split between Breakpoint.bplist/Breakpoint.bpbynumber (at class scope) and the breaks dictionary that lives on the Bdb() instance. The problems described in issue24160 occurs when those two parts get out of sync.
In interactive mode, each pdb.run() call creates a new instance of Bdb(). In this case the user would like the breakpoints to be remembered between calls. This PR adds a function _load_breaks to Bdb, which is called in its constructor and populates the instance's breaks dict with the data from the Breakpoint class.
Tests were added in both test_bdb (to test it directly) and in test_pdb (to test it with the interactive usecase).
https://bugs.python.org/issue24160