-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use python-pin error #8
Comments
Please write your full configuration version OS, pintool, c++ and other? |
I use ubuntu 14.04 x86_x64 pin is pin-2.14-71313-gcc.4.4.7-linux gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) And I can run your all examples for example strace.py . I only want to write some python myself. |
What branch did you use? Python_Pin or Python_Pin_Windows? |
I didn't test this out, but you should be able to increment |
I am a new-comer as far as Pintools are concerned, but from what you are suggesting, i guess it may give erroneous results. You are suggesting to increment count in "instrumentation code", which is called only first time when an instruction is about to execute. If the same instruction is executed again, instrumentation routine will not be invoked and you may not increase the count because you have not registered any analysis callback. This is what I understood from the PIN doc. I will be happy to know if I am wrong here. |
@tosanjay I agree with you. so we need register a callback in function Instrument(). |
I try convert the simplest pintools: inscount0.cpp to python. But It has a segment error:
C: Tool (or Pin) caused signal 11 at PC 0x7f946f1dd8b9
I don't know what's wrong with me.
Here is the python source I write:
import sys, pin
info = file("count.out", "w")
count = 0
def docount(ins_info):
global count
count = count + 1
def instruction(ins):
pin.INS_InsertCall(pin.IPOINT_BEFORE, ins, docount)
def fini():
global count
info.writelines(str(count))
info.close()
pin.INS_AddInstrumentFunction(instruction, 0)
pin.AddFiniFunction(fini, 0)
The text was updated successfully, but these errors were encountered: