static VOID InstrumentTrace(TRACE trace, VOID *v) { CheckSPAlign(); static int testNum = 0; switch (testNum++) { case 0: // Test an out-of-line analysis call. // TRACE_InsertCall(trace, IPOINT_BEFORE, AFUNPTR(AtTraceOutOfLine), IARG_END); break; case 1: // Test an out-of-line "if/then" call. // TRACE_InsertIfCall(trace, IPOINT_BEFORE, AFUNPTR(AtTraceIf), IARG_END); TRACE_InsertThenCall(trace, IPOINT_BEFORE, AFUNPTR(AtTraceOutOfLine), IARG_END); break; case 2: // Test an inlined analysis call. // TRACE_InsertCall(trace, IPOINT_BEFORE, AFUNPTR(CheckSPAlign), IARG_END); break; case 3: // Test an "if/then" call where the "then" is inlined. // TRACE_InsertIfCall(trace, IPOINT_BEFORE, AFUNPTR(AtTraceIf), IARG_END); TRACE_InsertThenCall(trace, IPOINT_BEFORE, AFUNPTR(CheckSPAlign), IARG_END); break; case 4: // Test an out-of-line analysis call with context argument // TRACE_InsertCall(trace, IPOINT_BEFORE, AFUNPTR(AtTraceOutOfLine), IARG_CONTEXT, IARG_END); break; case 5: // Test an out-of-line "if/then" call with context argument // TRACE_InsertIfCall(trace, IPOINT_BEFORE, AFUNPTR(AtTraceIf), IARG_END); TRACE_InsertThenCall(trace, IPOINT_BEFORE, AFUNPTR(AtTraceOutOfLine), IARG_CONTEXT, IARG_END); break; default: testNum = 0; break; } }
static VOID InstrumentTrace(TRACE trace, VOID *v) { CheckSPAlign(); static int testNum = 0; switch (testNum++) { case 0: // Test an out-of-line analysis call. // TRACE_InsertCall(trace, IPOINT_BEFORE, AFUNPTR(AtTraceOutOfLine), IARG_END); break; case 1: // Test an out-of-line "if/then" call. // TRACE_InsertIfCall(trace, IPOINT_BEFORE, AFUNPTR(AtTraceIf), IARG_END); TRACE_InsertThenCall(trace, IPOINT_BEFORE, AFUNPTR(AtTraceOutOfLine), IARG_END); break; #if 0 // These tests are disabled because Pin cannot yet inline analysis routines that // use xmm registers. case 2: // Test an inlined analysis call. // TRACE_InsertCall(trace, IPOINT_BEFORE, AFUNPTR(CheckSPAlign), IARG_END); break; case 3: // Test an "if/then" call where the "then" is inlined. // TRACE_InsertIfCall(trace, IPOINT_BEFORE, AFUNPTR(AtTraceIf), IARG_END); TRACE_InsertThenCall(trace, IPOINT_BEFORE, AFUNPTR(CheckSPAlign), IARG_END); break; #endif default: testNum = 0; break; } }