Panayiotis Irakleous Panayiotis Irakleous - 1 year ago 149
C++ Question

Pin tool and itrace

Hello i run the pin toll itrace.cpp file to get the trace of the code.

#include <stdio.h>
#include "pin.H"

FILE * trace;

// This function is called before every instruction is executed
// and prints the IP
VOID printip(VOID *ip) { fprintf(trace, "%p\n", ip); }

// Pin calls this function every time a new instruction is encountered
VOID Instruction(INS ins, VOID *v)
// Insert a call to printip before every instruction, and pass it the IP

// This function is called when the application exits
VOID Fini(INT32 code, VOID *v)
fprintf(trace, "#eof\n");

/* ===================================================================== */
/* Print Help Message */
/* ===================================================================== */

INT32 Usage()
PIN_ERROR("This Pintool prints the IPs of every instruction executed\n"
+ KNOB_BASE::StringKnobSummary() + "\n");
return -1;

/* ===================================================================== */
/* Main */
/* ===================================================================== */

int main(int argc, char * argv[])
trace = fopen("itrace.out", "w");

// Initialize pin
if (PIN_Init(argc, argv)) return Usage();

// Register Instruction to be called to instrument instructions
INS_AddInstrumentFunction(Instruction, 0);

// Register Fini to be called when the application exits
PIN_AddFiniFunction(Fini, 0);

// Start the program, never returns

return 0;

And i have the following traces:

This is a sample :


How i can find in which command each of this trace belongs to?
I used objdump -S myfile but i cant find anything.

Thank you in advance.

Answer Source

Find IP in a program using

objdump -S exe > exe.asm

Search 40001e90 instead of 0x40001e90

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download