Game Development Reference
In-Depth Information
Debugging with MonoDevelop -
conditional breakpoints
Breakpoints are critical for debugging, and represents the starting point at which
application execution pauses into a debug state. Often, they'll be just what you need to
set a breakpoint and start debugging! However, there are times when breakpoints, in
their default configuration, can become annoying. One example is when a breakpoint
is set inside a loop. Sometimes, you only want the breakpoint to take effect or pause
execution after a loop has exceeded a specified number of iterations, as opposed to
taking effect from the beginning and on every iteration afterwards. By default, a
breakpoint inside a loop will pause the execution on every iteration, and if the loop
is long, such pausing behavior can quickly become tiresome. To resolve this, you can
set breakpoint conditions that specify the states that must be true for the breakpoint
to take effect. To set a breakpoint condition, right-click on the breakpoint and choose
Breakpoint Properties
from the context menu, as shown here:
Accessing Breakpoint Properties to set a condition
Selecting
Breakpoint Properties
will display the
Breakpoint Properties
dialog where
conditions for the breakpoint can be specified. In the
Condition
section, choose the
Break when condition is true
option and then use the
Condition expression
ield
to specify the condition that determines the breakpoint. For loop conditions, the
expression
i>5
will trigger the breakpoint when the loop iterator has exceeded
5
.
Of course, the variable
i
should be substituted for your own variable names.