void * hello(void * arg) { int i,j; // Calling this function causes pin to allocate a new context void * th = PIN_NewThread(); for (j = 0; j < 1000; j++) { // Calling this function tells pin to switch from original program execution // to instrumented (jitted) execution. PIN_ExecuteInstrumented(th); for (i = 0; i < n; i++) { a[i] = 1; } // Calling this function tells pin to switch from instrumented execution // to original program execution. PIN_ExecuteUninstrumented(arg); } return 0; }
int main() { int i; void * th = PIN_NewThread(); fprintf(stderr,"Thread handle %p\n", th); PIN_ExecuteInstrumented(th); for (i = 0; i < 10; i++) { a[i] = i; } PIN_ExecuteUninstrumented(); return 0; }