| |||
| Home > Setting Breakpoints > Setting breakpoints on lines of source code > Setting breakpoints on a multi-statement line | |||
To set breakpoints on a multi-statement line:
Connect to a suitable target.
Load the image to the target.
Open the source file containing the line of source
where you want to set the breakpoint, for example, dhry_1.c.
In the dhry_1.c source, locate
the for loop at line 145.
Right-click on the first statement, that is for
(Run_Index = 1.
Select Insert Breakpoint on Statement from the context menu.
Right-click on the middle statement, that is Run_Index
<= Number_Of_Runs.
Select Insert Breakpoint on Statement from the context menu.
Right-click on the last statement, that is ++Run_Index.
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.
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.
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.
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.
ARM® Compiler toolchain Compiler Reference