
Both components live in a single executable, a Pintool. These two components are instrumentation and analysis code.
#CITATION ITRACE CODE#
The code to execute at insertion points.A mechanism that decides where and what code is inserted.Although there are some exceptions for conditional branches, generally speaking, if an instruction is never executed then it will not be instrumented.Ĭonceptually, instrumentation consists of two components: It does not matter in what section they reside. Pin instruments all instructions that are actually excuted. When generating code, Pin gives the user an opportunity to inject their own code (instrumentation). The original code is only used for reference. In JIT mode, the only code ever executed is the generated code. Pin makes this efficient by keeping all of the generated code in memory so it can be reused and directly branching from one sequence to another. After regaining control, Pin generates more code for the branch target and continues execution. The generated code sequence is almost identical to the original one, but Pin ensures that it regains control when a branch exits the sequence. It then transfers control to the generated sequence.

Pin intercepts the execution of the first instruction of the executable and generates ("compiles") new code for the straight line code sequence starting at this instruction. The input to this compiler is not bytecode, however, but a regular executable. The best way to think about Pin is as a "just in time" (JIT) compiler.

It supports the Linux*, macOS* and Windows* operating systems and executables for the IA-32, Intel(R) 64 and Intel(R) Many Integrated Core architectures. Pin is a tool for the instrumentation of programs.
