Setting Breakpoint Options

Related Topics:

Creating a Conditional Breakpoint Breakpoints Window

An option is an additional restriction placed on a breakpoint. The simplest option tests for a condition after the program arrives at a breakpoint.

To apply an option to a breakpoint:

1. In the Debugging window, choose Windows Breakpoints or Execute Set Breakpoints.

2. If the Details pane of the Breakpoints window is not displayed, click the Add/Change Breakpoint button (the Add/Change breakpoint button toggles to Hide Details).

3. Create a new breakpoint or select an existing breakpoint from the scrolling list.

4. Choose one of the following from the Option list box:
None No option set.
If Stop program execution only if the condition evaluates to nonzero when the event occurs.
While in Stop program execution only if the event occurs while within the scope of a specified function, or within any function called from the specified function.
Thread Stop program execution if the thread that caused the event matches the specified thread ID.
Count Stop program execution when the breakpoint is reached a specified number of times. For example, if you have set a breakpoint in a loop and you want to stop program execution on the fifteenth iteration of the loop, set Count to 14.
CUSTOM Use this option if you want to put two or more options on a breakpoint. Enter the options as if you were typing them in the <computer>dbx<\computer> command line. See <xref events> for more information.

5. Click Add if you are creating a new breakpoint or Change if you are modifying an existing breakpoint.

Note - Use If on location-type breakpoints; the associated breakpoint only triggers if the condition is true.

Note - Use the While In option on non-location type breakpoints. The While In option accepts a function name, so the associated breakpoint (for example, an In Class or On Exception breakpoint) activates when it gets to that function and deactivates when it leaves the function.