Ubuntu: Using intel's pin tool on Ubuntu?



Question:

I'd like to use Intel's pin tool on Ubuntu 12.04 and having trouble installing it. I downloaded pin for Linux 64bit from here http://www.pintool.org/, extracted the package and compiled the examples in source/tools/.. How do I run pin now? Tried:

pin  pin.sh  ./pin  

etc, none seemed to work :( Do I need to install any extra libraries or...? Thanks!


Solution:1

Basically pin tools are designed as "Just In Time (JIT)" compilers, so the two components behind the architecture are Instrumentation and Analysis Code. As you may know, PIN tools has the ability to instrument the architecture independently. Therefore, as instrumentation occurs immediately before the code sequence execute the first time, you have to treat the program directly with the target benchmark.

Here are some tips:

First of all go to the parent directory of the Pin tool, the general usage of pin is defined as :

pin [OPTION] [-t <tool> [<toolargs>]] -- <command line>  

Secondly, export the path of pin to the env to be able to use it everywhere else (in my case is):

export PATH=$PATH:/home/amir/pin-2.12-58423-gcc.4.4.7-linux/  

Now you can use it everywhere to pin the instrument (compilation counts, branch takens, etc).

i.e. : There are some sample sources in order to start working around in

$ cd source/tools/ManualExamples  

like inscount, linux_buffer, etc. use the make command to g++ compile the source codes:

make inscount0.test  

and then :

$ pin -t inscount0.so -- /bin/ls  

to get the output of the /bin/ls.

Hope that helps you.


Solution:2

Intel's PIN is a binary instrumentation framework, and can be used to instrument binary programs on the fly. To specify what instructions exactly must be instrumented, and with which, you specify a pintool to pin. There's not really any further 'installation'.

Here an example from the README file on how to use pin:

pin -t obj-intel64/opcodemix.so -- /bin/ls

This will instrument and run /bin/ls, the output for this tool is in opcodemix.out.


Solution:3

Is your host architecture 64-bit (amd64)? If so, you'll need to add 32-bit (i386) support as pin is a 32-bit program.

$ file pin  pin: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.2.5, stripped  

First add the architecture support to dpkg.

$ sudo dpkg --add-architecture i386  $ sudo aptitude update   # or apt-get if you use that  

Then install the i386 versions of the needed libraries. You'll likely need:

  • libc6:i386
  • libstdc++6:i386
  • libgcc1:i386
  • libelf1:i386
  • libdw1:i386.

Check the Pin User Guide on Intel's site, specifically the section Libraries for Linux. Alternatively, you could spin up an i386 Ubuntu VM and use that without having to pollute your x64 library space.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »