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
2dfec552
Commit
2dfec552
authored
Jul 30, 2010
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow giving an explicit line number to "until".
parent
e0230918
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
13 deletions
+37
-13
Doc/library/pdb.rst
Doc/library/pdb.rst
+7
-3
Lib/bdb.py
Lib/bdb.py
+5
-2
Lib/pdb.py
Lib/pdb.py
+23
-8
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Doc/library/pdb.rst
View file @
2dfec552
...
@@ -330,10 +330,14 @@ by the local file.
...
@@ -330,10 +330,14 @@ by the local file.
executes called functions at (nearly) full speed, only stopping at the next
executes called functions at (nearly) full speed, only stopping at the next
line in the current function.)
line in the current function.)
.. pdbcommand:: unt(il)
.. pdbcommand:: unt(il)
[lineno]
Continue execution until the line with the line number greater than the
Without argument, continue execution until the line with a number greater
current one is reached or when returning from current frame.
than the current one is reached.
With a line number, continue execution until a line with a number greater or
equal to that is reached. In both cases, also stop when the current frame
returns.
.. pdbcommand:: r(eturn)
.. pdbcommand:: r(eturn)
...
...
Lib/bdb.py
View file @
2dfec552
...
@@ -174,10 +174,13 @@ class Bdb:
...
@@ -174,10 +174,13 @@ class Bdb:
# Derived classes and clients can call the following methods
# Derived classes and clients can call the following methods
# to affect the stepping state.
# to affect the stepping state.
def
set_until
(
self
,
frame
):
#the name "until" is borrowed from gdb
def
set_until
(
self
,
frame
,
lineno
=
None
):
"""Stop when the line with the line no greater than the current one is
"""Stop when the line with the line no greater than the current one is
reached or when returning from current frame"""
reached or when returning from current frame"""
self
.
_set_stopinfo
(
frame
,
frame
,
frame
.
f_lineno
+
1
)
# the name "until" is borrowed from gdb
if
lineno
is
None
:
lineno
=
frame
.
f_lineno
+
1
self
.
_set_stopinfo
(
frame
,
frame
,
lineno
)
def
set_step
(
self
):
def
set_step
(
self
):
"""Stop after one line of code."""
"""Stop after one line of code."""
...
...
Lib/pdb.py
View file @
2dfec552
...
@@ -71,11 +71,11 @@ w(here)
...
@@ -71,11 +71,11 @@ w(here)
An arrow indicates the "current frame", which determines the
An arrow indicates the "current frame", which determines the
context of most commands.
context of most commands.
d(own) [
count
]
d(own) [
count
]
Move the current frame count (default one) levels down in the
Move the current frame count (default one) levels down in the
stack trace (to a newer frame).
stack trace (to a newer frame).
u(p) [
count
]
u(p) [
count
]
Move the current frame count (default one) levels up in the
Move the current frame count (default one) levels up in the
stack trace (to an older frame).
stack trace (to an older frame).
...
@@ -140,9 +140,12 @@ n(ext)
...
@@ -140,9 +140,12 @@ n(ext)
Continue execution until the next line in the current function
Continue execution until the next line in the current function
is reached or it returns.
is reached or it returns.
unt(il)
unt(il) [lineno]
Continue execution until the line with a number greater than
Without argument, continue execution until the line with a
the current one is reached or until the current frame returns.
number greater than the current one is reached. With a line
number, continue execution until a line with a number greater
or equal to that is reached. In both cases, also stop when
the current frame returns.
r(eturn)
r(eturn)
Continue execution until the current function returns.
Continue execution until the current function returns.
...
@@ -883,7 +886,19 @@ class Pdb(bdb.Bdb, cmd.Cmd):
...
@@ -883,7 +886,19 @@ class Pdb(bdb.Bdb, cmd.Cmd):
do_d
=
do_down
do_d
=
do_down
def
do_until
(
self
,
arg
):
def
do_until
(
self
,
arg
):
self
.
set_until
(
self
.
curframe
)
if
arg
:
try
:
lineno
=
int
(
arg
)
except
ValueError
:
print
(
'*** Error in argument:'
,
repr
(
arg
),
file
=
self
.
stdout
)
return
if
lineno
<=
self
.
curframe
.
f_lineno
:
print
(
'*** "until" line number is smaller than current '
'line number'
,
file
=
self
.
stdout
)
return
else
:
lineno
=
None
self
.
set_until
(
self
.
curframe
,
lineno
)
return
1
return
1
do_unt
=
do_until
do_unt
=
do_until
...
@@ -1518,8 +1533,8 @@ and in the current directory, if they exist. Commands supplied with
...
@@ -1518,8 +1533,8 @@ and in the current directory, if they exist. Commands supplied with
-c are executed after commands from .pdbrc files.
-c are executed after commands from .pdbrc files.
To let the script run until an exception occurs, use "-c continue".
To let the script run until an exception occurs, use "-c continue".
To let the script run u
ntil
a given line X in the debugged file, use
To let the script run u
p to
a given line X in the debugged file, use
"-c '
break X' -c continue
"."""
"-c '
until X'
"."""
def
main
():
def
main
():
import
getopt
import
getopt
...
...
Misc/NEWS
View file @
2dfec552
...
@@ -475,6 +475,8 @@ C-API
...
@@ -475,6 +475,8 @@ C-API
Library
Library
-------
-------
- In pdb, allow giving a line number to the "until" command.
- Issue #1437051: For pdb, allow "continue" and related commands in
- Issue #1437051: For pdb, allow "continue" and related commands in
.pdbrc files. Also, add a command-line option "-c" that runs a
.pdbrc files. Also, add a command-line option "-c" that runs a
command as if given in .pdbrc.
command as if given in .pdbrc.
...
...
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