Intel PIN tool: Get a trace of EFLAGS values

335 Views Asked by At

I am trying to get a complete dynamic trace of a program using Intel PIN tool. My trace would have : {Instruction address, Instruction, Operands, EFLAGS, OPCODES}.

I have managed to get the first three using xed-interface.H provided in the kit. Now, I want to get the EFLAGS state at each instruction. Also, I would like to get the opcodes in the same file.

Which API should I use to achieve this?

1

There are 1 best solutions below

1
On

Add IARG_CONST_CONTEXT to the list of arguments in the INS_InsertCall() call in the instrumentation routine. Then you can call PIN_GetContextRegval(ctx, REG_EFLAGS, &pin_register) to get the value of eflags in pin_register.