HP B1476 68020 User Manual page 247

Debugger/emulator
Table of Contents

Advertisement

Macro arguments
You can use formal macro arguments throughout the macro definition. They
are replaced at execution time by the actual parameters present in the macro
call. The actual parameter is coerced to the corresponding formal parameter
type. If coercion is not possible, an error occurs.
You must list the macro's arguments (if any), along with their associated types,
when you define the macro. For example, the following listing defines
arguments for the built-in macro strcpy():
Debugger Macro Add int strcpy(target, source)
char
*target;
char
*source;
Macro variables
Variables that are local to the macro may be created within the macro. The
definition of local variables follows the rules of C, with the exception that you
cannot define variables with initializers. Variables may be defined to have a
simple type, or they may be of type array or pointer. Derived types (such as
structures and unions), enumerated types, and typedefs are not legal within
macros.
The macro processor does not recognize the C keywords extern, auto, static,
and register. The macro processor reports an error if these C keywords are
used. Static variables are not scoped within a macro. However, symbols
created with the Symbol Add command (debugger symbols) are globally
scoped, and can be accessed from within a macro. Register variables (such as
@PC) may also be accessed from within a macro.
Target program symbols can also be accessed from within a macro. Variables
which are globally scoped within the target program can be accessed directly.
File static, function static, and automatic variables can be accessed directly
only if the current context of the debugger is the module or function in which
they are scoped. Otherwise, they require a module or function name as a
qualifier before they can be accessed. For example, assume the following
definition exists in your target program, in a file called init.c:
...
static int i;
...
foo(int parm)
{
static int j;
auto
int k;
...
Chapter 8: Using Macros and Command Files
/* file static */
/* function static */
/* function local
*/
Using Macros
223

Advertisement

Table of Contents
loading

This manual is also suitable for:

B1476 68030

Table of Contents