title: intel pin RTN_InsertCall multiple function arguments
body: <p>I'm trying to obtain the values of the arguments to a function using intel pin. Single argument functions are simple enough using the example ManualExamples/malloctrace.cpp . However, when I try to get the argument values with multiple arguments I run into trouble. </p>
  
  <p>Eg. Trying to capture the argument values of the following function:</p>
  
  <pre><code>void funcA(int a, int b, int c) {
      printf("Actual: %i %i %i\n", a,b,c);
  }
  </code></pre>
  
  <p>With the following pin code</p>
  
  <pre><code>VOID funcHandler(CHAR* name, int a, int b, int c) {
     printf("Pin: %s %i %i %i\n", name, a, b, c);
  }
  
  VOID Image(IMG img, VOID *v) {
      RTN funcRtn = RTN_FindByName(img, "funcA");
      if (RTN_Valid(funcRtn)) {
          RTN_Open(funcRtn);
          RTN_InsertCall(funcRtn, IPOINT_BEFORE, (AFUNPTR)funcHandler, 
                        IARG_ADDRINT, "funcA", IARG_FUNCARG_ENTRYPOINT_VALUE, 
                        0, IARG_END);
          RTN_Close(funcRtn);
      }
  }
  </code></pre>
  
  <p>I get the following output</p>
  
  <pre><code>Pin: funcA 0 -656937200 -10
  Actual: 0 -10 0
  Pin: funcA 1 -656937200 -9
  Actual: 1 -9 20
  Pin: funcA 2 -656937200 -8
  Actual: 2 -8 40
  </code></pre>
  
  <p>I can see that I'm close, but something isn't aligned properly. I know about RTN_ReplaceProbed, but I need to use pin in jit mode as I need instruction level instrumentation. </p>