15.4. Running a macro

You can run macros from:

You enter the macro name followed by a set of parentheses containing the macro arguments, separated by commas.

Macro names are case sensitive and must be entered as shown in the definition. The macro arguments are converted to the types specified in the macro definition. If RealView Debugger cannot convert the arguments it generates an error message.

If a macro returns a value, then use the CEXPRESSION command to run the macro. This displays the value returned, for example:


> cexpression tutorial(4)
value=4  Result is: 4  0x00000004

The macro tutorial() is the macro created in Creating a macro.

You can define a macro with a name that is identical to a command or keyword used by RealView Debugger. You can then use the macro name in an expression and submit it on the command line where it is interpreted correctly.

If, however, you submit the macro name as a command, RealView Debugger cannot identify it as a macro. To overcome this, use the prefix MACRO when entering macro names that might conflict with debugger keywords or command names:


MACRO macro_name()

Macros take higher precedence than target functions. If a target function and a macro have the same name, the macro is executed unless the target function is fully qualified. For example, strcpy is a predefined debugger macro, while PROG\strcpy is a function within the module PROG. The predefined macro is referenced as strcpy(dest,src), while PROG\strcpy(dest,src) refers to the function within PROG.

Copyright © 2002-2006 ARM Limited. All rights reserved.ARM DUI 0153H
Non-Confidential