Chapter 6: Using Macros and Command Files
If you have the following macro definition:
Debugger Macro Add int ten_to_the(y)
the macro will compute 10**y by calling the previously defined macro power().
To call a macro on execution of a breakpoint
• Select Attach Macro from the Code window pop-up menu.
• When using the command line to set a breakpoint, add a semicolon (;) and the
name of the macro to the command.
When setting breakpoints, you can attach a macro to the breakpoint.
Whenever the breakpoint is encountered, the macro is executed. Depending
on the return value of the macro, program execution will either stop or
Macros attached to breakpoints can test program or user-defined variables
before determining whether execution should break or not (by returning zero
or nonzero values, respectively).
Macro control flow statements within a breakpoint macro can alter execution
flow in the target environment based on target or debugger variable values.
You can also include C expressions in macros. By using control flow
statements and C expressions in macros, you can patch your C programs.
The macro cannot call itself.
return power(10,y); }
If the macro returns zero, program execution stops at the breakpoint.
If the macro returns a nonzero value, program execution continues at the