I'm trying to assign the value of EIP to a C variable but get this error message:
Here is the code:Code:bad register name `%eip'
I have managed to get the stack pointer in a similar way without problem, like this:Code:void *ip = 0; asm("movl %%eip, %0" : "=r"(ip) ); printf("Current instruction position: %p\n", ip);
Any idea what the problem might be?Code:void *p = 0; asm("movl %%esp, %0" : "=r"(p) ); printf("Stack pointer: %p\n", p);