8.6. Stepping until a user-specified condition is met

There are times when you want to see what happens when various parts of an image get executed. You can step through the code by specifying a condition, in the form of a C-style expression. When the condition is met, that is the condition is nonzero, execution halts.


Be aware of the following:

  • Using this feature causes execution to slow down and might result in errors because of timing issues.

  • If a breakpoint is hit during a step operation, then the breakpoint might stop execution before the step operation completes, depending on the breakpoint conditions.

  • When stepping RealView Debugger uses temporary breakpoints to stop execution. However, when stepping in ROM or Flash, RealView Debugger attempts to set temporary hardware breakpoints. If there are not enough breakpoint resources available, then RealView Debugger implements single instruction stepping, and displays the following warning:

    Warning: Unable to set Software Break or Hardware Break at address, falling back to instruction stepping.

You must run the image until it stops before the area of interest. To control the point at which the image stops, either:

To step until a specific condition is met:

  1. Connect to your target.

  2. Load the required image, for example dhrystone.axf.

  3. Click the Locate PC button on the Debug toolbar to view the source file that contains the PC scope (dhry_1.c in this example).

  4. Display line 149.

  5. Click on the Proc_5 function name.

  6. Select Debug → Run to Cursor from the Code window main menu. The program begins execution.

  7. When prompted for the number of runs, enter 1000. The program continues execution and runs to the position of the cursor in the source code. A red box shows the location of the PC at line 149.

  8. Select Step Until Condition... from the Debug menu to open the Prompt dialog box.

  9. Enter an expression to test, using the standard C expression format. Enter Run_Index==10 for this example.

  10. Click OK. The dialog box closes, and execution stops when Run_Index equals 10.


    Step Until Condition... steps into called functions. Therefore, execution might stop at a line of code within a called function.

See also:

Copyright © 2002-2011 ARM. All rights reserved.ARM DUI 0153N