A method and system of monitoring code after being compiled or assembled
is provided. Software code instructions, such as a function preamble
and/or a data manipulation instruction, are identified using debug
information and then dynamically replaced with an instruction that will
branch execution to a scratchpad buffer. A routine is inserted into the
scratchpad buffer, and includes instruction(s) to generate output to a
trace buffer. Subsequent instructions in the scratchpad may execute the
replaced instruction(s) and branch back to the address of the program
code immediately following the original address of the replaced
instruction.