主权项 |
1. A processor-implemented code instrumentation method for instrumenting object codes of a program to enable memory access tracing, comprising:
identifying an object code block to be executed circularly in the object codes; identifying, without modifying said object code block, at least one memory access instruction in the object code block where a memory address to be accessed during the circular execution of the object code block remains unchanged; inserting a routine for tracing the memory access to be executed by the at least one memory access instruction outside the object code block without modifying said object code block; wherein the at least one memory access instruction comprises at least two memory access instructions; wherein the memory address to be accessed by the at least one memory access instruction is addressed by using the same register; wherein addressing mode for the memory address to be accessed by the at least one memory access instruction comprises one or more of direct addressing, register indirect addressing, register relative addressing, base-plus-index addressing and base relative-plus-index addressing; and wherein the inserting comprising inserting an instruction for saving the present execution context that occurs at the inserting position; inserting an instruction for recording information required for tracing the memory access to be executed by the at least one memory access instruction; and inserting an instruction for restoring the saved present execution context.
|