| |||
| Home > Working with the CLI > Source patching with macros > Patching example to insert lines of source code | |||
To insert a few lines of source code in your program:
Define a macro containing the statements that you want to insert.
Start a debugging session and set a breakpoint on the source line following the point where you want to insert the new lines.
Attach your macro to this breakpoint.
Run the program until execution stops at the breakpoint.
The source statements in your macro are interpreted and executed. The macro completes.
Program execution continues normally.
Using a macro in this way might cause problems with compiler optimizations, for example the ordering of instructions might have been altered by the compiler.
the following in the RealView Debugger User Guide: