3.3. Setting a watchpoint

This example runs the same program again, this time with a watchpoint that stops execution a few times. You can examine values when execution stops.

  1. Select Reload Current Image from the File menu.

  2. Select Go from the Execute menu (or press F5) to reach the first breakpoint, set by default at the beginning of function main() and indicated by a red disc and marker. You can see the source file dhry_1.c with a breakpoint and the current position indicated at line number 78.

  3. Select Go from the Execute menu (or press F5) to continue execution.

  4. Enter 770 when you are prompted for the number of runs to execute. Execution continues until it reaches the breakpoint at line 150 for the 750th time. This is the breakpoint you defined in Setting a breakpoint.

  5. Select Watchpoints from the System Views menu, right-click in the Watchpoints system view, and select Add to display the Watchpoint Properties dialog (shown in Figure 3.4). For this example you specify that execution stops every sixth time the value of Run_Index changes.

    Figure 3.4. Setting a watchpoint

    Setting a watchpoint

    Enter Run_Index in the Item field in the Watch group.

    Set the out of... field in the Condition group to a value of 6. This is the number of times the watched value has to change to trigger the watchpoint action.

    Click the OK button.

  6. Select Variables from the Processor Views menu if the Variables processor view is not already displayed. Reposition or resize the window if necessary. Click the Local tab and look for the Run_Index variable.

    The value of Run_Index is currently 750. If it is displayed in hexadecimal notation, right-click on the value and select Format ? Decimal to change the display format to decimal.

  7. Press F5 to resume execution. The value of the Run_Index local variable changes to 756. It is now displayed in red to show that its value has changed since the previous display. Execution stops.

  8. Examine any displayed values, then press F5 again to resume execution and perform six more runs. When the value of Run_Index becomes greater than the number of runs you specified, the test results are displayed and execution terminates. (Again, the dhrystone test results are meaningless, because of the interruptions to the timing measurements, but the use of a watchpoint has been demonstrated.)

  9. Delete the watchpoint you set up for this example, by right-clicking on its line in the Watchpoints window and selecting Delete from the pop-up menu, then close down the Watchpoints system view.

Copyright © 1999-2004 ARM Limited. All rights reserved.ARM DUI 0066F
Non-Confidential