258
❘
CHAPTER 12
Debugging ironPython APPlicAtions
➤➤
b or break: Defines a breakpoint when you supply a line number or a function name. When
you provide a function name, the breakpoint appears at the first executable line within the
function. If an application spans multiple files, you can specify a filename, followed by a
colon, followed by a line number (no function name allowed), such as
ShowFilters2:1
.
A breakpoint can also include a condition. To add the condition, follow the breakpoint
specification with a comma and the condition you want to use, such as
ShowFilters2:2, Filter == None
. If you type just b or break, the debugger shows the
current breakpoints. Use the
cl
or
clear
command to clear breakpoints you create.
➤
➤
bt, w, or where: Prints a stack trace with the most current frame at the bottom of the list.
You can use this feature to see how the application arrived at the current point of execution.
➤
➤
c, cont, or continue: Continues application execution until the application ends or the debugger
encounters a breakpoint.
➤
➤
cl or clear: Clears one or more breakpoints. You can specify the breakpoint to clear by providing
one or more breakpoint numbers separated by spaces. As an alternative, you can supply a line
number or a filename and line number combination (where the filename and line number are
separated by a colon).
➤
➤
commands: Defines one or more commands that execute when the debugger arrives at a line
of code specified by a breakpoint. You include the optional breakpoint as part of the com-
mands command. If you don’t supply a breakpoint, then the commands command refers to
the last breakpoint you set. To stop adding commands to a breakpoint, simply type end. If
you want to remove the commands for a breakpoint, type commands, press Enter, type end,
and press Enter again. A command can consist of any interactive Python or debugger com-
mand. For example, if you want to automatically move to the next line of code, you’d simply
add step as one of the commands.
➤
➤
condition: Adds a condition to a breakpoint. You must supply a breakpoint number and a
Boolean statement (in string format) as arguments. The debugger doesn’t honor a breakpoint
with a condition unless the condition evaluates to
True
. The condition command lets you
add a condition to a breakpoint after defining the breakpoint, rather than as part of defining
the breakpoint. If you use condition with a breakpoint, but no condition, then the debugger
removes a condition from a breakpoint, rather than adding one.
➤
➤
Do'stlaringiz bilan baham: |