HELP!! with plugin PIN debugger

Storm Shadow

Administrator
Staff member
Developer
Ida Pro Expert
Elite Cracker
After looking at the plugins.cfg from idademo 6.4 \plugins\plugins.cfg

Code:
        ; Debugger plugins
        Windbg_debugger            windbg_user 0      0  DEBUG
        Local_Windows_debugger      win32_user  0      0  DEBUG
        Remote_Windows_debugger    win32_stub  0      0  DEBUG
        Local_Bochs_debugger        bochs_user  0      0  DEBUG
        Local_Linux_debugger        linux_user  0      0  DEBUG
        Remote_Linux_debugger      linux_stub  0      0  DEBUG
        Remote_ARMLinux/Android_debugger armlinux_stub 0 0 DEBUG ; only remote
        Remote_WinCE_debugger      wince_stub  0      0  DEBUG ; only remote
        Local_Mac_OS_X_debugger    mac_user    0      0  DEBUG
        Remote_Mac_OS_X_debugger    mac_stub    0      0  DEBUG
        Remote_Symbian_debugger    epoc_user  0      0  DEBUG ; only remote
        Remote_iPhone_v1.x_debugger iphone_stub 0      0  DEBUG ; only remote
        Remote_GDB_debugger        gdb_user    0      0  DEBUG ; only remote
        [COLOR=#ff0000]PIN_debugger                pin_user    0      0  DEBUG[/COLOR]
        ; Other plugins
I notice that
PIN_debugger pin_user 0 0 DEBUG
is in the plugins.cfg 6.4 but not in ida 6.1
any i wanted to build it.
Spent whole day building the ida pin debugger

Its build but give an error both in Ida demo 6.4 and ida 6.1



Building the PIN tool from hexrays site


Before using the PIN tracer the PIN tool module (distributed only in source code form) must be
built as the Intel PIN license disallows redistributing PIN tools in binary form.
First, you will need to download the IDA SDK for the version of IDA you are using. The SDK can
be found there: http://www.hex-rays.com/products/ida/support/download.shtml
The building process of the PIN tool is different for Windows and Linux. To build it in Windows:
1. Download PIN from http://www.pintool.org , and unpack it on your hard drive.
WARNING: the PIN tools are a little sensitive to spaces in paths. Therefore, we
recommend unpacking in a no-space path. E.g., “C:\pin”, but not “C:\Program Files
(x86)\”.
2. Install Visual Studio. It is possible to build the PIN tool with the Express version of Visual
Studio for C++.
3. Download pintool source and unpack it into /path/to/pin/source/tools/. IDA pintool can be
found here: https://www.hex-rays.com/products/ida/support/freefiles/idapin.zip
4. Open IDADBG.sln in Visual Studio, select the correct build configuration (either Win32 or
x64) and build the solution.

After alot off error i manage to build it with vc2010 and pin download
IA32 and intel64 (x86 32 bit and 64 bit) revision 58423 Apr 11, 2013 VC10

http://software.intel.com/sites/landingpage/pintool/downloads/pin-2.12-58423-msvc10-windows.zip

I made an folder c:\pin2 then extracted the DL to pin2

then i downloaded the pin from ida https://www.hex-rays.com/products/ida/support/freefiles/idapin.zip and extracted it to C:\pin2\source\

Then in vc2010
FILE>>open Project/Solution>>C:\pin2\source\all_pin_related.sln
I set the build to release.
header an resource files are fixed with project properties
C++ >>General >>(AdditionalIncludeDirectories) C:\pin2\extras\components\include;C:\pin2\extras\components\include\util;C:\pin2\extras\xed2-ia32\include;C:\pin2\source\include\pin\gen;C:\pin2\source\include\pin;%


Lib errrors are fixed with
Linker>>>input(AdditionalDependicies)pin.lib;libxed.lib;libcpmt.lib;libcmt.lib;pinvm.lib;kernel32.lib;ntdll-32.lib;ws2_32.lib

I changhed the cofiiggoration>>>General >>>targetExtension to .plw
plw is like dll but ida use extension plw.

Build log

Code:
1>------ Build started: Project: idadbg, Configuration: Release Win32 ------
1>Build started 26.01.2014 20:57:11.
1>InitializeBuildStatus:
1>  Creating "Release\idadbg.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>  idadbg.cpp
1>Link:
1>     Creating library C:\pin2\source\Release\idadbg.lib and object C:\pin2\source\Release\idadbg.exp
1>  IDADBG.vcxproj -> C:\pin2\source\Release\idadbg.plw
1>FinalizeBuildStatus:
1>  Deleting file "Release\idadbg.unsuccessfulbuild".
1>  Touching "Release\idadbg.lastbuildstate".
1>
1>Build succeeded.
1>
1>Time Elapsed 00:00:02.11
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

I now copy the Idadbg.plw to ida\plugin folder both ida pro 6.1 and demo 6.4

I get this error when loading Ida PRo


LoadLibrary(C:\Users\zadow\Downloads\ida\ida\plugins\idadbg.plw) error: modul not found.

C:\Users\zadow\Downloads\ida\ida\plugins\idadbg.plw: can't load file



Any ideas ???
 

Attachments

  • pin_tutorial.pdf
    852.1 KB · Views: 20
  • idadbg.plw.rar
    570.3 KB · Views: 23

Rip Cord

Administrator
Staff member
Developer
well, it doesn't even show in the list of debuggers for me
local bochs, win32 blah blah blah but not pin

in pin_tutorial.pdf page 5
2. Directory with idadbg: This is the directory where the idadbg.so or idadbg.dll PIN tool resides. Please note that only the directory must be specified.
wonder why they don't use plw

btw, in forum posts, I can't get colored text to display properly in a code block, like in your post above shows
[COLOR=#ff0000]PIN_debugger pin_user 0 0 DEBUG[/COLOR]
instead of red :(
PIN_debugger pin_user 0 0 DEBUG
 

computerline

New member
Ida Pro Expert
Plugin Loaded, but not compatible with my version, so you must add pin directory in your Environt Variable and copy pinvm.dll to IDA Directory

Code:
idadbg.plw: incompatible plugin version, skipped
 

Storm Shadow

Administrator
Staff member
Developer
Ida Pro Expert
Elite Cracker
I think they left out something on purpose

http://tinyurl.com/padv3o2
if you download the tool and open the "all_pin_related.sln" l all in editor it makes sense.

the idadbg is supposed to be an dll its actuelly the pinwm.dll just called idadbg.dll

Then you have to build the pin_user.plw with all pin releated , they just dont tell you how.
the pin_user.plw goes to plugin folder

Code:
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pin_user", "pin_remote.vcxproj", "{7B15DC49-31A0-468F-9E7B-F2E27A80FF61}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "idaq", "..\..\ui\qt\idaqv32.vcxproj", "{EB64A121-F5A9-4491-9571-8C1DD6EDA36D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "idadbg", "..\..\..\..\tools\pin\pin-2.12-53271-msvc10-ia32_intel64-windows\source\tools\MyPinTool\MyPinTool.vcxproj", "{639EF517-FCFC-408E-9500-71F0DC0458DB}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Win32 = Debug|Win32
        Debug|x64 = Debug|x64
        Release|Win32 = Release|Win32
        Release|x64 = Release|x64
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {7B15DC49-31A0-468F-9E7B-F2E27A80FF61}.Debug|Win32.ActiveCfg = Debug|Win32
        {7B15DC49-31A0-468F-9E7B-F2E27A80FF61}.Debug|Win32.Build.0 = Debug|Win32
        {7B15DC49-31A0-468F-9E7B-F2E27A80FF61}.Debug|x64.ActiveCfg = Debug|x64
        {7B15DC49-31A0-468F-9E7B-F2E27A80FF61}.Debug|x64.Build.0 = Debug|x64
        {7B15DC49-31A0-468F-9E7B-F2E27A80FF61}.Release|Win32.ActiveCfg = Release|Win32
        {7B15DC49-31A0-468F-9E7B-F2E27A80FF61}.Release|Win32.Build.0 = Release|Win32
        {7B15DC49-31A0-468F-9E7B-F2E27A80FF61}.Release|x64.ActiveCfg = Release|x64
        {7B15DC49-31A0-468F-9E7B-F2E27A80FF61}.Release|x64.Build.0 = Release|x64
        {EB64A121-F5A9-4491-9571-8C1DD6EDA36D}.Debug|Win32.ActiveCfg = Debug|Win32
        {EB64A121-F5A9-4491-9571-8C1DD6EDA36D}.Debug|Win32.Build.0 = Debug|Win32
        {EB64A121-F5A9-4491-9571-8C1DD6EDA36D}.Debug|x64.ActiveCfg = Debug|Win32
        {EB64A121-F5A9-4491-9571-8C1DD6EDA36D}.Release|Win32.ActiveCfg = Release|Win32
        {EB64A121-F5A9-4491-9571-8C1DD6EDA36D}.Release|Win32.Build.0 = Release|Win32
        {EB64A121-F5A9-4491-9571-8C1DD6EDA36D}.Release|x64.ActiveCfg = Release|Win32
        {639EF517-FCFC-408E-9500-71F0DC0458DB}.Debug|Win32.ActiveCfg = Debug|Win32
        {639EF517-FCFC-408E-9500-71F0DC0458DB}.Debug|Win32.Build.0 = Debug|Win32
        {639EF517-FCFC-408E-9500-71F0DC0458DB}.Debug|x64.ActiveCfg = Debug|x64
        {639EF517-FCFC-408E-9500-71F0DC0458DB}.Debug|x64.Build.0 = Debug|x64
        {639EF517-FCFC-408E-9500-71F0DC0458DB}.Release|Win32.ActiveCfg = Release|Win32
        {639EF517-FCFC-408E-9500-71F0DC0458DB}.Release|Win32.Build.0 = Release|Win32
        {639EF517-FCFC-408E-9500-71F0DC0458DB}.Release|x64.ActiveCfg = Release|x64
        {639EF517-FCFC-408E-9500-71F0DC0458DB}.Release|x64.Build.0 = Release|x64
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
EndGlobal


its presselly the same with other debugger lets add some debuggers from version 6.1 to new demo

Windbg_debugger windbg_user.plw
Local_Windows_debugger win32_user.plw
Remote_Windows_debugger win32_stub.plw
Local_Bochs_debugger bochs_user.plw
Remote_Linux_debugger linux_stub.plw
Remote_ARMLinux/Android_debugger armlinux_stub.plw
Remote_WinCE_debugger wince_stub,plw
Local_Mac_OS_X_debugger mac_user.plw
Remote_Mac_OS_X_debugger mac_stub.plw
Remote_Symbian_debugger epoc_user.plw
Remote_iPhone_v1.x_debugger iphone_stub.plw
Remote_GDB_debugger gdb_user.plw

works like an charm
4KNFv4m.png


But where to find the last stuff for building the pin_user.plw o_O
 

computerline

New member
Ida Pro Expert
I finally figureout, and success build idadbg.dll :)
Code:
\pin\ia32\bin>\pin\ia32\bin\pin.exe -t \pin\ia32\bin\idadbg.dll -p 1234 -- test.exe
This build up pin debug server, but we don't have ida plugin remote client :) So, I think we must code remote debug plugin, haha
 

Storm Shadow

Administrator
Staff member
Developer
Ida Pro Expert
Elite Cracker
i looked again and i do think we can build the pin_user also

i have some trouble though

getting this error

Code:
1>c:\pin2\source\include\pin\compiler_version_check2.H(83): fatal error C1189: #error :  "Unknown target architecture"
 

computerline

New member
Ida Pro Expert
i looked again and i do think we can build the pin_user also

i have some trouble though

getting this error

Code:
1>c:\pin2\source\include\pin\compiler_version_check2.H(83): fatal error C1189: #error :  "Unknown target architecture"

What project is pin_user ?
 
Top