11.14.2. Setting breakpoints on a multi-statement line

To set breakpoints on a multi-statement line:

  1. Connect to a suitable target.

  2. Load the image to the target.

  3. Open the source file containing the line of source where you want to set the breakpoint, for example, dhry_1.c.

  4. In the dhry_1.c source, locate the for loop at line 145.

  5. Right-click on the first statement, that is for (Run_Index = 1.

  6. Select Insert Breakpoint on Statement from the context menu.

  7. Right-click on the middle statement, that is Run_Index <= Number_Of_Runs.

  8. Select Insert Breakpoint on Statement from the context menu.

  9. Right-click on the last statement, that is ++Run_Index.

  10. Select Insert Breakpoint on Statement from the context menu.

Although you have set three breakpoints, because they are associated with the same line of code, only one breakpoint indicator is visible in the source tab.

Effect of optimizations

Be aware that optimizations might affect whether or not you can set a breakpoint on each statement of a multi-statement line. For example:

  • The prebuilt image dhrystone.axf is compiled with -O0, giving the best debug view. This enables you to set a breakpoint on each statement as described in the procedure.

  • If you rebuild the image with compiler optimization levels -O1 and -O2, you can still set a breakpoint on each statement of a multi-statement line. However, the Insert Breakpoint on Statement context menu option is not available for the first statement. You must use Insert Breakpoint instead, then use Insert Breakpoint on Statement for the remaining statements.

  • If you rebuild the image with compiler optimization levels -O3, then you cannot set a breakpoint on each statement of a multi-statement line. You can use Insert Breakpoint to set a breakpoint only on one of the statements.

Managing multiple breakpoints on a multi-statement line

If you have set multiple breakpoints on a source line containing multiple statements or on inline functions, then disabling the last breakpoint changes the marker disc. Figure 11.22 shows an example. If you disable any other breakpoint on the line, the marker remains unchanged.

Figure 11.22. Multiple breakpoints on a multi-statement line

Multiple breakpoints on a multi-statement line

You cannot place two breakpoints of the same type on the same statement. Also, you cannot set breakpoints on lines marked with downward pointing arrows.

See also

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