You can set breakpoints on global symbols using the Debug.breakexpr("expr") method. The type of the symbol will determine the breakpoint that is set. For example…

Debug.breakexpr("fn1") 

…will set a breakpoint on entry to the fn1 function, and…

Debug.breakexpr("var1") 

…will set a breakpoint when the variable var1 is written. This method can also be used set breakpoints on addresses. For example…

Debug.breakexpr("0x248") 

…will cause a breakpoint when the address 0x248 is executed, and…

Debug.breakexpr("(unsigned[1])0xec8") 

…will cause a breakpoint when the word at the address 0xec8 is written.

You can use the Debug.breakline("filename", linenumber) method to set breakpoints on specific lines of code. For example, to set a breakpoint at line number 4 of c:/directory/file.c, you can use:

Debug.breakline("c:/directory/file.c", 4) 

Note the use of forward slashes when specifying filenames.

To refer to the current file (the one where the debugger is located), you can use the Debug.getfilename() method. Similarly, the current line number is accessed using the Debug.getlinenumber() method. Using these functions, you can set a breakpoint at a line-offset from the current position. For example…

Debug.breakline(Debug.getfilename(), Debug.getlinenumber()+4) 

…will break at 4 lines after the current line.

You can use the Debug.breakdata("expr", value, readNotWrite) method to set a breakpoint for when a value is written to a global variable. For example…

Debug.breakdata("var1", 4, false) 

…will cause a breakpoint when the value 4 is written to variable var. The third parameter, readNotWrite specifies whether a breakpoint is set on reading (true) or writing (false) the data.

Each method of setting a breakpoint accepts three optional arguments: temporary, counter, and hardware.

A temporary breakpoint is removed the next time it occurs. For example…

Debug.breakexpr("fn1()", true) 

…will break on entry to fn1 unless another breakpoint occurs before this one.

Counted breakpoints are ignored for the specified number of hits. For example…

Debug.breakexpr("fn1()", false, 9) 

…will break the 10th time fn1 is called.

The hardware argument specifies whether the debugger should use a hardware breakpoint in preference to a software breakpoint. This can be used to set breakpoints on code that is copied to RAM prior to the copying.

The breakexpr and breakline methods return a positive breakpoint number that can be used to delete the breakpoint using the Debug.deletebreak(number) method. For example:

fn1bkpt = Debug.breakexpr("fn1")
…
Debug.deletebreak(fn1bkpt) 

To delete all breakpoints, supply zero to the deletebreak method. Note that temporary breakpoints do not have breakpoint numbers.

The Debug.showbreak(number) method displays information about a breakpoint.

To show all breakpoints, supply zero to the showbreak method.

Some targets support exception breakpoints, which can be listed using the Debug.showexceptions() method. For example, on an ARM9 or XScale target:

> Debug.showexceptions()
Reset disabled
Undef enabled
SWI disabled
P_Abort enabled
D_Abort enabled
IRQ disabled
FIQ disabled
>

You can enable or disable an exception with the Debug.enableexception("exception", enable) method. For example…

Debug.enableexception("IRQ", true) 

…will enable breakpoints when the IRQ exception occurs.

Some targets support breakpoint chaining. This enables breakpoints to be paired, with one breakpoint enabling another one. For example:

> first = Debug.breakdata("count", 3)
> second = Debug.breakexpr("fn1")
> Debug.chainbreak(first, second)

When count is written with the value 3, the breakpoint at fn1 is enabled; so when fn1 is subsequently called, if ever, the breakpoint occurs. To remove breakpoint chaining, specify 0 as the second argument. For example:

Debug.chainbreak(first, 0) 

Deleting either of the chained breakpoints will break the chain.