I want to modify next instruction before it fetches, in best answer of This post in foo function, *p
points to the next instruction in main function. I want to modify content of where *p
points at. For example I want to change the next instruction to a jump instruction. How to I can do this?
void foo()
{
void** p = search((void**)&p, __builtin_return_address(0));
// modify content of where *p points at.
}
int main()
{
foo();
//next instruction. *p points here
return 0;
}
I want to do this with gcc compiler, on intel Core-i7 3632QM processor.