The debugger can set breakpoints by evaluating simple C-like expressions. Note that the exact capabilities offered by the hardware to assist in data breakpointing will vary from target to target; please refer to the particular target interface you are using and the capabilities of your target silicon for exact details. The simplest expression supported is a symbol name. If the symbol name is a function, a breakpoint occurs when the first instruction of the symbol is about to be executed. If the symbol name is a variable, a breakpoint occurs when the symbol has been accessed; this is termed a data breakpoint. For example, the expression x will breakpoint when x is accessed. You can use a debug expression (see Debug expressions) as a breakpoint expression. For example, x will breakpoint when element 4 of array x is accessed, and @sp will breakpoint when the sp register is accessed.
Data breakpoints can be specified, using the == operator, to occur when a symbol is accessed with a specific value. The expression x == 4 will breakpoint when x is accessed and its value is 4. The operators <, >=, >;, >=, ==, and != can be used similarly. For example, @sp <= 0x1000 will breakpoint when register sp is accessed and its value is less than or equal to 0x1000.
You can use the operator ‘&’ to mask the value you wish to breakpoint on. For example, (x & 1) == 1 will breakpoint when x is accessed and has an odd value.
You can use the operator ‘&&’ to combine comparisons. For example…
(x >= 2) && (x <= 14)
…will breakpoint when x is accessed and its value is between 2 and 14.
You can specify an arbitrary memory range using an array cast expression. For example, (char)(0x1000) will breakpoint when the memory region 0x1000–0x10FF is accessed.
You can specify an inverse memory range using the ! operator. For example !(char)(0x1000) will breakpoint when memory outside the range 0x1000–0x10FF is accessed.