23 PIN_ERROR(
"Pin tool to gather calling context on each instruction and associate each memory access to its data object (balanced-binary-tree technique).\n" + KNOB_BASE::StringKnobSummary() +
"\n");
36 char* envPath = getenv(
"CCTLIB_CLIENT_OUTPUT_FILE");
40 snprintf(name,
sizeof(name),
"%s", envPath);
43 gethostname(name + strlen(name),
MAX_FILE_PATH - strlen(name));
45 sprintf(name + strlen(name),
"%d", pid);
46 cerr <<
"\n Creating log file at:" << name <<
"\n";
51 for (
int i = 0; i < argc; i++) {
68 INS_InsertPredicatedCall(ins, IPOINT_BEFORE, (AFUNPTR)
SimpleCCTQuery, IARG_THREAD_ID, IARG_UINT32, slot, IARG_END);
72 if (INS_IsControlFlow(ins) || INS_IsRet(ins)) {
77 if (INS_IsStackRead(ins) || INS_IsStackWrite(ins))
80 if (INS_IsMemoryRead(ins) || INS_IsMemoryWrite(ins)) {
82 UINT32 memOperands = INS_MemoryOperandCount(ins);
85 for (UINT32 memOp = 0; memOp < memOperands; memOp++) {
86 INS_InsertPredicatedCall(ins, IPOINT_BEFORE, (AFUNPTR)
MemAnalysisRoutine, IARG_MEMORYOP_EA, memOp, IARG_THREAD_ID, IARG_END);
91 int main(
int argc,
char* argv[]) {
93 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)