5.10.10. Setting watches

Watches monitor variables during execution of your image. To set a series of watches and to monitor their value during execution of the image:

  1. Select Target ? Reload Image to Target to reload the image.

  2. At line 127 in dhry_1.c, right-click on the line number and select Set Break from the context menu, to set an unconditional breakpoint.


    This is not the same as the Set Break... option.

  3. On line 125, right-click on the variable Number_Of_Runs to display the Source Variable Name context menu.

  4. Select Watch from the menu. This adds the chosen variable to the Watch pane and displays the current value, if known. The Watch pane is the center pane in the middle row of the default Code window (see Figure 4.1).

  5. Click the Run button on the Debug toolbar to execute the image. Enter a large number of runs, for example 50000.

    The program stops execution at line 127, and the Watch pane shows the current value in Number_Of_Runs. It is shown as hexadecimal by default. To see the value as an unsigned decimal:

    1. Right-click on the variable in the Watch pane, and select Format... from the context menu.

    2. In the List Selection dialog box, select Unsigned Decimal.

    3. Click Ok.

    The value changes to an unsigned decimal.

  6. Click the Run button again on the toolbar to execute the image.

  7. Click the Stop Execution button to stop the program before it finishes.

    With the processor halted, monitor changes in the variables in the Watch pane. Depending on where you halted execution, values that changed at the last pane update are displayed in dark blue. Values that changed at a previous pane update are displayed in light blue.

  8. Click the Run button again to complete program execution.

  9. Clear the breakpoint on line 127 in dhry_1.c.

  10. Remove the variables from the Watch pane as follows:

    1. Click the name of the variable in the Watch pane to select it.

    2. Press Delete.

      The values list is refreshed after the entry has been removed.

For full details on setting watches, see the chapter that describes working with debug views in RealView Debugger v1.8 User Guide.

Copyright © 2002-2005 ARM Limited. All rights reserved.ARM DUI 0181G