23 PIN_ERROR(
"Pin tool to gather calling context on each instruction and associate each memory access to its data object (shadow memory technique).\n" + KNOB_BASE::StringKnobSummary() +
"\n");
34 char* envPath = getenv(
"CCTLIB_CLIENT_OUTPUT_FILE");
38 snprintf(name,
sizeof(name),
"%s", envPath);
41 gethostname(name + strlen(name),
MAX_FILE_PATH - strlen(name));
43 sprintf(name + strlen(name),
"%d", pid);
44 cerr <<
"\n Creating log file at:" << name <<
"\n";
49 for (
int i = 0; i < argc; i++) {
66 INS_InsertPredicatedCall(ins, IPOINT_BEFORE, (AFUNPTR)
SimpleCCTQuery, IARG_THREAD_ID, IARG_UINT32, slot, IARG_END);
70 if (INS_IsControlFlow(ins) || INS_IsRet(ins)) {
75 if (INS_IsStackRead(ins) || INS_IsStackWrite(ins))
78 if (INS_IsMemoryRead(ins) || INS_IsMemoryWrite(ins)) {
80 UINT32 memOperands = INS_MemoryOperandCount(ins);
83 for (UINT32 memOp = 0; memOp < memOperands; memOp++) {
84 INS_InsertPredicatedCall(ins, IPOINT_BEFORE, (AFUNPTR)
MemAnalysisRoutine, IARG_MEMORYOP_EA, memOp, IARG_THREAD_ID, IARG_END);
89 int main(
int argc,
char* argv[]) {
91 if (PIN_Init(argc, argv))
int main(int argc, char *argv[])
void ClientInit(int argc, char *argv[])
VOID MemAnalysisRoutine(void *addr, THREADID threadId)
VOID SimpleCCTQuery(THREADID id, const uint32_t slot)
VOID InstrumentInsCallback(INS ins, VOID *v, const uint32_t slot)
#define INTERESTING_INS_ALL
DataHandle_t GetDataObjectHandle(VOID *address, const THREADID threadId)
int PinCCTLibInit(IsInterestingInsFptr isInterestingIns, FILE *logFile, CCTLibInstrumentInsCallback userCallback, VOID *userCallbackArg, BOOL doDataCentric=false)
ContextHandle_t GetContextHandle(const THREADID id, const uint32_t slot)