To patch a line of code using a macro
1 Set a breakpoint at the line you wish to patch.
An easy way to set the breakpoint is to click the right mouse button on the line
in the Code window.
2 Attach a macro to the breakpoint.
Choose Attach Macro ... from the Code window pop-up menu.
3 Write a macro to patch the code.
In the Macro Operations dialog box, enter the name of a new macro and click
on the Edit button.
The macro may contain any number of C expressions and debugger commands.
The last two lines of the macro should be:
$Modify Register @PC = # next_line $;
where next_line is the number of the line after the breakpoint. Return 0
instead of 1 if you want the debugger to stop after the macro is executed.
Exit the editor as usual, then click on the Attach button in the Macro
Operations dialog box.
Now whenever the breakpoint line is encountered, the debugger will execute
the macro before the patched line is executed. The macro will execute your
patch code, then skip to the next line.
Chapter 5: Editing Code and Data
Patching Source Code