12.9.4. Considerations when using macros with breakpoints

When you set a breakpoint, you can also associate a macro with that breakpoint to set up complex break conditions. When you attach a macro to a breakpoint, it acts as a condition. For example, you can test your program variables and decide how the breakpoint behaves when it activates.

The frequency that a macro runs when the breakpoint activates depends on the order it appears with other conditions.

You can use conditional statements in your macro to change the execution path when the breakpoint is activated depending on variables on the debug target system or on the host. This enables you to control program execution during your debugging session or when there is no user intervention.

You can also use high-level expressions in macros. Combining these conditional statements and expressions enables you to patch your source program.

Breakpoint macros can be used to fill out stubs, such as I/O handling, and also to simulate complex hardware.


You cannot use the GO, GOSTEP, STEPINSTR, STEPLINE, STEPO, or STEPOINSTR commands in a macro that is attached to a breakpoint. If any of these commands are present in such a macro, the following messages are displayed:

Error: Cannot perform operation - thread is running.
Error: E0081: Runtime error in macro.

RealView Debugger recognizes several predefined macros containing commonly used functions. These macros can also be attached to breakpoints. However, if you are attaching a macro that you create yourself, then you must first load it into RealView Debugger.

Controlling breakpoint behavior with macro return values

The macro return value enables you to control what action RealView Debugger takes when a breakpoint is activated:

  • If the macro returns a nonzero value, RealView Debugger continues program execution. Any qualifiers and actions that appear after the macro are not processed, and the breakpoint activation is not recorded.

  • If a macro returns a value of zero, RealView Debugger stops program execution. Any actions that are assigned to the macro are performed.


This behavior might be different if you assign additional condition qualifiers to the breakpoint.

See also

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