c++cbinaryfilesinstrumentationintel-pin

PIN - get process ID for the Binary being instrumented?


Hi does anyone know how to get the process ID for the binary that is being instrumented by PIN? So for example if I have something like:

pin -t MyTool -- somebinary

How do I get the process ID for 'somebinary' inside the PINTool that I'm trying to write. I checked the documentation but there doesn't seem to be anything I can use, or maybe I've overlooked something? Thanks.


Solution

  • I think you can directly use getpid(). This is what I do when making Pin tools.

    Pin also provides its own process related APIs.