Share via


Setting Breakpoints at a Memory Location Within the Current Scope

You can use the Breakpoints dialog box to stop program execution at a particular memory location or when a specified condition occurs.

Note   You can also set breakpoints outside of the current scope. For more information, see Setting Breakpoints Outside the Current Scope.

To set a breakpoint at a memory address

  1. From the View menu, click Debug Windows and Disassembly. The Disassembly window opens.

  2. In the Disassembly window, move the insertion point to the line where you want the program to break.

  3. Click the Insert/Remove Breakpoint toolbar button.

    A red dot appears in the left margin, indicating that the breakpoint is set.

To set a conditional breakpoint

  1. From the Edit menu, click Breakpoints.

    The Breakpoints dialog box appears.

  2. Select the Location tab.

  3. In the Break At text box, type the location (source line number, memory address, or function name) where you want to set the breakpoint.

  4. Click Condition.

    The Breakpoint Condition dialog box appears.

  5. Fill in the Expression and Number Of Elements text boxes as you would for a data breakpoint.

  6. In the Breakpoint Condition dialog box, click OK to set the condition.

  7. In the Breakpoints dialog box, click OK to set the breakpoint.

To set a conditional breakpoint with a skip count

  1. From the Edit menu, click Breakpoints.

    The Breakpoints dialog box appears.

  2. In the Breakpoints dialog box, select the Location tab.

  3. In the Break At text box, type a location (source line number, memory address, or function name) where you want to set the breakpoint. .

  4. Click Condition.

    The Breakpoint Condition dialog box appears.

  5. Fill in the Expression and Number Of Elements text boxes as you would for a data breakpoint.

  6. Fill in the Enter The Numbers Of Times To Skip Before Stopping text box. If you want your program to break every Nth time the condition is met at the specified location, set the Enter The Numbers Of Times To Skip Before Stopping to N - 1. (The debugger skips the breakpoint the first N times.)

  7. In the Breakpoint Condition dialog box, click OK to set the condition.

  8. In the Breakpoints dialog box, click OK to set the breakpoint.

Note   The interface does not allow you to set both Enter The Numbers Of Times To Skip Before Stopping and Number Of Elements for the same breakpoint.