参考:http://software.intel.com/sites/landingpage/pintool/docs/62732/Pin/html/
http://blog.nruns.com/blog/2013/10/07/TracingExecutionWithPin-Carlos/
Pin is a tool for the instrumentation of programs. It supports the Android*, Linux*, OSX* and Windows* operating systems and executables for the IA-32, Intel(R) 64 and Intel(R) Many Integrated Core architectures.
Pin allows a tool to insert arbitrary code (written in C or C++) in arbitrary places in the executable. The code is added dynamically while the executable is running. This also makes it possible to attach Pin to an already running process.
Pin provides a rich API that abstracts away the underlying instruction set idiosyncracies and allows context information such as register contents to be passed to the injected code as parameters. Pin automatically saves and restores the registers that are overwritten by the injected code so the application continues to work. Limited access to symbol and debug information is available as well.
有点类似于Detours的意义,动态插桩。但是Detours的粒度是函数级别,而Pin的粒度是指令级别。
这也很好理解,Detours是Microsoft开发的,而Pin是Intel开发的。
1. 怎样在Windows下编译samples of Pintools
可以到http://software.intel.com/en-us/articles/pintool-downloads下载不同的Pin版本。
但是在Windows平台下,自版本56759以后,nmake被改成了make,但是内部仍然调用的cl.exe等工具进行生成,make问题不成功,没办法,只好退回49306版本。
cd .\source\tools\SimpleExamples
..\nmake TARGET=ia32 tools
转载自原文链接, 如需删除请联系管理员。
原文链接:Intel Pin基础,转载请注明来源!