Pin - A Binary Instrumentation Tool - FAQ

By Osnat Levi,

Published:06/13/2012   Last Updated:06/13/2012

Home | DownloadsFAQ | NewsgroupPapers | XED SDE | PinPoints | PinPlay | DrDebug

Frequently-Asked Questions

A) Bugs

How do I report bugs?

Please post to the Pinheads Newsgroup. Provide as much information as possible so that we can reproduce the bug. What is the command line? What is the system you are running on. On Linux* do:

cat /etc/*release* uname -a


What is the full name of the kit that you are using? Problems that can be reproduced using the sample tools in the kit are the easiest for us to reproduce.

I get an error that Pin app terminated abnormally due to signal ...

First, you can find out what each signal means by typing: man 7 signal. Next, you can debug the problem using GDB as described in the user manual.

I get this message: ./pin: error while loading shared libraries: cannot restore segment prot after reloc: Permission denied

This is SELinux. Try changing the context of the pin binary in the Bin directory:

chcon -t textrel_shlib_t Bin/pin

My IPOINT_AFTER for a RTN is not being called

IPOINT_AFTER for RTN is implemented by instrumenting the .ret. instruction. Pin finds the ret by scanning the body of the function. Sometimes a procedure doesn.t return, but instead jumps to another procedure which does the exit. To reliably instrument after a function has exited. You can replace the function with a wrapper function, and put the before/after actions in the wrapper function.

B) Building PinTools

Can I create threads in my PinTool?

Yes, Pin provides an interface that allows PinTools to create and manage their own threads. For example, the PIN_SpawnInternalThread() function can be used to create a new tool's internal thread in the current process. See the "Pin Thread API" section in the Pin's manual for detailed descriptions of this and other threading functions provided by Pin.

Note, PinTools can NOT link against the pthreads library nor can they use pthreads functions on Linux. The reason for this is that using pthreads in the tool would interfere with the pthreads library linked into the application (e.g. they both try to take over the same signal handlers). Similarly, PinTools should not use Win32 threading API (e.g. CreateThread()) on Windows because this does not allow distinguishing between threads created by the application and the tool's internal threads.

C) Features

Does Pin handle multi-threaded programs


Does Pin instrument shared libraries?


Does Pin handle self-modifying code?


Does Pin handle programs with threads and signals?

Pin is able to instrument all code, including threads and signals. It provides precise exception state in handlers; a handler cannot detect that the program is instrumented by looking at the context of the interrupted thread.

Does Pin change the application code and data addresses?

Pin allocates memory in the address space of the application, and that may cause application shared libraries and dynamically allocated data to move. If you use the option -separate_memory, pin will try to allocate its data at an address that is not normally used and will be less likely to perturb the application. On linux, you can statically link pin and tool. Eliminating pin and tool shared libraries will reduce the chance that pin alters the memory layout of an application.

Note: Recent linux kernels intentionally move the location of stack and dynamically allocated data from run to run, even if you are not using pin. On RedHat-based systems you can workaround this by running Pin as follows:

$ setarch i386 pin -t pintool -- app


setarch i386 tells the kernel to disable Address Space Layout Randomization.

Alternatively, you can permanently disable ASLR on your host machine by following the instructions listed here

D) General

What version of CPU do I need to run Pin?

Pin will run on all Intel (R) 64 and Intel (R) MIC Architectures. A IA-32 processor needs the following features:

  • C8 - CMPXCHG8B
  • SSE2


Pentium III processors do not have SSE2. Pentium IV processors can run Pin. You can check the capabilities of your processor on linux with the following command:

cat /proc/cpuinfo

Does Pin support non-Intel CPUs?

Pin has not been tested on systems with non-Intel processors. Therefore, incompatible or proprietary instructions in non-Intel processors may cause Pin to function incorrectly. Any attempt to instrument code not supported by Intel processors may lead to failures.

What version of OS do I need to run Pin?
We believe pin works on these platforms:


  • Android
    • Ice Cream Sandwich (4.0) and Jelly Bean (4.1-4.3).
  • Linux
    • All distributions. See the user guide section about linux libraries if you are using probe mode or are getting warnings about missing libraries.
  • OS X
    • Lion (10.7), Mountain Lion (10.8) and Mavericks (10.9).
  • Windows
    • Windows XP, Windows Vista and Windows 7, Windows 8 (Desktop) and Windows 8.1 (Desktop), 32 and 64 bit versions.
    • Windows Server 2003, 2008 and 2008 R2.

Can pin instrument a 32 bit application running on a 64 bit OS?

Yes. You will have to build the 32 bit version of the tool. See the user manual.

How can I run spec programs with Pin?

In your SPEC config file (one of the files in $SPEC/config), add the following two lines:

submit=/my/path/to/pin/Bin/pin -t /my/pin/tool -- $command use_submit_for_speed=yes


Now SPEC will automatically run Pin with whatever benchmarks it runs. Note that you need the full path name for your pin and pintool binaries.

Is Pin open source?

The instrumentation engine is not open source, but the example tools are open source. They have a BSD-style license, and can be redistributed in any form, as long as you keep the copyright notice.

What is the Pin license?

The license for Pin is included in the kit in a file called LICENSE and can be previewed here. The Pin kit includes some separately licensed software and its license is in a file called ExtLib/EXTLICENSE and can be previewed here.

When you use the Pin kit to build a pintool on linux, it will link statically with libelf and libdwarf. The libraries were written by a third party. For the convenience of pintool developers, we include these libraries in the Pin kit. They have a LGPL license. If you want to distribute a pintool, you are responsible for ensuring that you comply with the LGPL.

I used Pin for my latest paper. What citation should I include?

Chi-Keung Luk, Robert Cohn, Robert Muth, Harish Patil, Artur Klauser, Geoff Lowney, Steven Wallace, Vijay Janapa Reddi, Kim Hazelwood. "Pin: Building Customized Program Analysis Tools with Dynamic Instrumentation," Programming Language Design and Implementation (PLDI), Chicago, IL, June 2005, pp. 190-200.

Product and Performance Information


Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804