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
fa5b0c0e
Commit
fa5b0c0e
authored
Jul 11, 1997
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for conditional breakpoints (Jim Fulton, with some changes).
parent
02264add
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
7 deletions
+22
-7
Lib/pdb.py
Lib/pdb.py
+22
-7
No files found.
Lib/pdb.py
View file @
fa5b0c0e
...
@@ -96,27 +96,39 @@ class Pdb(bdb.Bdb, cmd.Cmd):
...
@@ -96,27 +96,39 @@ class Pdb(bdb.Bdb, cmd.Cmd):
print
self
.
get_all_breaks
()
# XXX
print
self
.
get_all_breaks
()
# XXX
return
return
# Try line number as argument
# Try line number as argument
try
:
arg
=
eval
(
arg
,
self
.
curframe
.
f_globals
,
self
.
curframe
.
f_locals
)
except
:
print
'*** Could not eval argument:'
,
arg
return
# Check for condition
try
:
arg
,
cond
=
arg
except
:
arg
,
cond
=
arg
,
None
try
:
try
:
lineno
=
int
(
eval
(
arg
)
)
lineno
=
int
(
arg
)
filename
=
self
.
curframe
.
f_code
.
co_filename
filename
=
self
.
curframe
.
f_code
.
co_filename
except
:
except
:
# Try function name as the argument
# Try function name as the argument
import
codehack
import
codehack
try
:
try
:
func
=
eval
(
arg
,
self
.
curframe
.
f_globals
,
func
=
arg
self
.
curframe
.
f_locals
)
if
hasattr
(
func
,
'im_func'
):
if
hasattr
(
func
,
'im_func'
):
func
=
func
.
im_func
func
=
func
.
im_func
code
=
func
.
func_code
code
=
func
.
func_code
except
:
except
:
print
'*** Could not eval argument:'
,
arg
print
'*** The specified object'
,
print
'is not a function'
,
arg
return
return
lineno
=
codehack
.
getlineno
(
code
)
lineno
=
codehack
.
getlineno
(
code
)
filename
=
code
.
co_filename
filename
=
code
.
co_filename
# now set the break point
# now set the break point
err
=
self
.
set_break
(
filename
,
lineno
)
err
=
self
.
set_break
(
filename
,
lineno
,
cond
)
if
err
:
print
'***'
,
err
if
err
:
print
'***'
,
err
do_b
=
do_break
do_b
=
do_break
def
do_clear
(
self
,
arg
):
def
do_clear
(
self
,
arg
):
...
@@ -352,10 +364,13 @@ class Pdb(bdb.Bdb, cmd.Cmd):
...
@@ -352,10 +364,13 @@ class Pdb(bdb.Bdb, cmd.Cmd):
self
.
help_b
()
self
.
help_b
()
def
help_b
(
self
):
def
help_b
(
self
):
print
"""b(reak) [lineno | function]
print
"""b(reak) [lineno | function]
[, "condition"]
With a line number argument, set a break there in the current
With a line number argument, set a break there in the current
file. With a function name, set a break at the entry of that
file. With a function name, set a break at the entry of that
function. Without argument, list all breaks."""
function. Without argument, list all breaks. If a second
argument is present, it is a string specifying an expression
which must evaluate to true before the breakpoint is honored.
"""
def
help_clear
(
self
):
def
help_clear
(
self
):
self
.
help_cl
()
self
.
help_cl
()
...
...
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