Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3f94089a
Commit
3f94089a
authored
Jul 30, 2010
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#5294: Fix the behavior of pdb "continue" command when called in the top-level debugged frame.
parent
d72e043b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
3 deletions
+52
-3
Lib/bdb.py
Lib/bdb.py
+7
-3
Lib/test/test_pdb.py
Lib/test/test_pdb.py
+42
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/bdb.py
View file @
3f94089a
...
...
@@ -109,6 +109,8 @@ class Bdb:
self
.
is_skipped_module
(
frame
.
f_globals
.
get
(
'__name__'
)):
return
False
if
frame
is
self
.
stopframe
:
if
self
.
stoplineno
==
-
1
:
return
False
return
frame
.
f_lineno
>=
self
.
stoplineno
while
frame
is
not
None
and
frame
is
not
self
.
stopframe
:
if
frame
is
self
.
botframe
:
...
...
@@ -165,10 +167,12 @@ class Bdb:
but only if we are to stop at or just below this level."""
pass
def
_set_stopinfo
(
self
,
stopframe
,
returnframe
,
stoplineno
=
-
1
):
def
_set_stopinfo
(
self
,
stopframe
,
returnframe
,
stoplineno
=
0
):
self
.
stopframe
=
stopframe
self
.
returnframe
=
returnframe
self
.
quitting
=
0
# stoplineno >= 0 means: stop at line >= the stoplineno
# stoplineno -1 means: don't stop at all
self
.
stoplineno
=
stoplineno
# Derived classes and clients can call the following methods
...
...
@@ -184,7 +188,7 @@ class Bdb:
def
set_step
(
self
):
"""Stop after one line of code."""
self
.
_set_stopinfo
(
None
,
None
)
self
.
_set_stopinfo
(
None
,
None
)
def
set_next
(
self
,
frame
):
"""Stop on the next line in or below the given frame."""
...
...
@@ -211,7 +215,7 @@ class Bdb:
def
set_continue
(
self
):
# Don't stop except at breakpoints or when finished
self
.
_set_stopinfo
(
self
.
botframe
,
None
)
self
.
_set_stopinfo
(
self
.
botframe
,
None
,
-
1
)
if
not
self
.
breaks
:
# no breakpoints; run without debugger overhead
sys
.
settrace
(
None
)
...
...
Lib/test/test_pdb.py
View file @
3f94089a
...
...
@@ -122,6 +122,48 @@ def test_pdb_skip_modules_with_callback():
"""
def
test_pdb_continue_in_bottomframe
():
"""Test that "continue" and "next" work properly in bottom frame (issue #5294).
>>> def test_function():
... import pdb, sys; inst = pdb.Pdb()
... inst.set_trace()
... inst.botframe = sys._getframe() # hackery to get the right botframe
... print(1)
... print(2)
... print(3)
... print(4)
>>> with PdbTestInput([
... 'next',
... 'break 7',
... 'continue',
... 'next',
... 'continue',
... 'continue',
... ]):
... test_function()
> <doctest test.test_pdb.test_pdb_continue_in_bottomframe[0]>(4)test_function()
-> inst.botframe = sys._getframe() # hackery to get the right botframe
(Pdb) next
> <doctest test.test_pdb.test_pdb_continue_in_bottomframe[0]>(5)test_function()
-> print(1)
(Pdb) break 7
Breakpoint 1 at <doctest test.test_pdb.test_pdb_continue_in_bottomframe[0]>:7
(Pdb) continue
1
2
> <doctest test.test_pdb.test_pdb_continue_in_bottomframe[0]>(7)test_function()
-> print(3)
(Pdb) next
3
> <doctest test.test_pdb.test_pdb_continue_in_bottomframe[0]>(8)test_function()
-> print(4)
(Pdb) continue
4
"""
def
pdb_invoke
(
method
,
arg
):
"""Run pdb.method(arg)."""
import
pdb
;
getattr
(
pdb
,
method
)(
arg
)
...
...
Misc/NEWS
View file @
3f94089a
...
...
@@ -475,6 +475,9 @@ C-API
Library
-------
- Issue #5294: Fix the behavior of pdb's "continue" command when called
in the top-level debugged frame.
- Issue #5727: Restore the ability to use readline when calling into pdb
in doctests.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment