define

Format: define name([arguments]) {body}

Creates a macro inside the debugger.

name is the name of the macro followed by a set of arguments to pass to the macro.

The body of the macro is a command list which may contain if statements and while loops. Macros also return a value by using the return command in the body. (See if, while, return, and "Command list".)

The only local variables created in the macro are the given arguments. All other variables refer to either a variable in your program or to debugger special variables. See "Special variables". The debugger searches the list of arguments before the registers, special variables, or program variables. As a result, if an argument in a macro has the same name as a register, you cannot examine that register from within that macro.

A trace of the macro call stack is produced with the macrotrace command. See macrotrace. If an error occurs inside of a macro, a trace back is printed, and all macros will clear off the stack.

For example, if you define the following macro:

define fly(bat1, bat2) {return(bat1 + bat2)}

then enter:

fly(3,6)

The debugger displays:

9

Previous

Next



Copyright © 1999, Green Hills Software. All rights reserved.