#include <iostream>
_declspec(naked) int f() {
_asm {
call $ + 5
pop eax
ret
}
}
int main()
{
std::cout << std::hex << "curIp " << f() << std::endl;
return 0;
}
This assembly code only gets the address near the function when it is running.
This program is compiled in 32-bit and returns 0x401025 under normal circumstances, but it also returns 0x401025 when traced by pintool. I am very surprised that the code executed in CodeCache should have different addresses from the code executed by the original program.
The same results were obtained when I verified the Intel pintool CodeCache with exception related code.
Thanks for your help.
I have been thinking about this problem for many days and have read many articles about Intel pintool, but I still can’t figure it out.
sbb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1