2.3.82. MACRO

Enables you to run a predefined or user-defined macro.


MACRO macroname(parameters...)



Specifies that name of the macro.


The actual values of parameters required by the macro.


The MACRO command runs a macro. You can run macros in these ways:

  • as part of the expression in a CE command

  • as the argument to the MACRO command

  • as a command on its own.

The CE command enables you to see the result of the macro, as set with the RETURN statement. If the macro does not explicitly return information, or you do not have to know the return value, you can use the macro name as a command. However, in this case the macro is only run if the name does not match any other debugger command or any alias defined with ALIAS. You can therefore use the MACRO command to ensure that the command that is run is the macro, and not a debugger command or an alias.


It is recommended that, if you call macros in an INCLUDE file and they do not return a value, you use MACRO to make the call. This ensures that the future operation of the INCLUDE file is not changed if new commands are added to the debugger, for example using ALIAS.

Macros can also be invoked as actions associated with:

  • a window, for example VMACRO

  • a breakpoint, for example BREAKEXECUTION

  • deferred commands, for example BGLOBAL.


Macros that are not directly invoked from the command line cannot use execution-type commands, such as GO or STEPINSTR.


The following example shows how to use MACRO:

macro fgetc(50)

Read a character from the file associated with the file number 50 and throw it away, with the side effect of advancing the file pointer to the next character.

See also

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