Tuesday, March 17, 2015

A ready to use Intel PIN Visual Studio project

Intel PIN is a great tool, but configuring a Visual Studio project is not very straightforward from its documentation. I know a couple of people who have heard of it, but have given up after not being able to set up a working project easily.

I've uploaded a ready to use PIN Tool based on a sample code that comes with it. PIN itself is not included, you need to download it and then copy the Pin directory to the folder where PinTool.sln is located.

Download: PinTool.zip

3 comments:

Anonymous said...

I've been building PinTools for Linux before, but never got it to really work on Windows before this post. I can build using your project as a base but I'm unable to run it since I'm on x86_64 (error below). Do you have any pointers as to what changes I'll need to make, macros etc?

E: DBG_TRACE: Unexpected debugging event: EXCEPTION_DEBUG_EVENT: ExceptionCode = 0xc0000005, ExceptionAddress = 0x50271243, Instruction = 418b01a9f8fffeff0f85a80000002501
E: Incompatible operating system or incompatible software installed on the system
E: Pin is exiting due to fatal error

chaplja said...

Haven't used it for a while now, but you shouldn't really be making any changes. Can't tell what's wrong based on the error you posted. Do you have a minimal code sample which produces that error?

Anonymous said...

1. Download your PinTool project (http://sites.google.com/site/chaplja/PinTool.zip)
2. Download Intel Pin for Windows (http://software.intel.com/sites/landingpage/pintool/downloads/pin-2.14-71313-msvc12-windows.zip)
3. Open PinTool.sln and upgrade from v110 to v120
4. Change Include Directories from "xed2-ia32" to "xed-ia32"
5. Change Library Directories from "xed2-ia32" to "xed-ia32"
6. Build project

> Pin\pin.exe -t Release\PinTool.dll -- notepad
E: DBG_TRACE: Unexpected debugging event: EXCEPTION_DEBUG_EVENT: ExceptionCode = 0xc0000005, ExceptionAddress = 0x6e0b1243, Instruction = 418b01a9f8fffeff0f85a80000002501
E: Incompatible operating system or incompatible software installed on the system
E: Pin is exiting due to fatal error

> file Pin\pin.exe
Pin\pin.exe: PE32 executable (console) Intel 80386, for MS Windows

> file Release\PinTool.dll
Release\PinTool.dll: PE32 executable (DLL) (GUI) Intel 80386, for MS Windows

> file /cygdrive/c/WINDOWS/system32/notepad
/cygdrive/c/WINDOWS/system32/notepad: PE32+ executable (GUI) x86-64, for MS Windows

> systeminfo

OS Name: Microsoft Windows 10 Pro N
OS Version: 10.0.10586 N/A Build 10586
System Type: x64-based PC