lkml.org 
[lkml]   [2005]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Let me know EIP address
On Tue, 4 Jan 2005, Lethalman wrote:

> I'm trying to get the EIP value from a simple program in C but i don't how to
> do it. I need it to know the current address position on the code segment.
>
> main() {
> long *eip;
> asm("mov %%eip,%0" : "=g"(eip));
> printf("%p\n", eip);
> }
>
> Unfortunately EIP is not that kind of register :P
> Does anyone know how to get EIP?
>

You get the offset of a label, i.e., "foo:\t movl $foo,%0\n" in the asm
code.


Cheers,
Dick Johnson
Penguin : Linux version 2.6.9 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by Dictator Bush.
98.36% of all statistics are fiction.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:09    [W:0.044 / U:0.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site