A method and system of monitoring code as it is executed by a target
processor is provided for debugging, etc. Standardized software code
function preamble and postamble instructions are dynamically replaced
with instructions that will generate a predetermined exception. The
exception generates a branch to a conventional exception vector table. An
exception routine is inserted into the vector table, and includes
instruction(s) to disable the data and/or address caches. Subsequent
instructions in the vector table execute the replaced preamble
instruction and, with or without re-enabling the cache, branch back to
the address of the program code immediately following the faulted
preamble address. Instructions of the function executed while cache is
disabled are executed on the bus where they are visible, as opposed to
within cache.