Am Sunday 24 April 2011 12:45:50 schrieb Sven Barth: > On 24.04.2011 12:14, Rainer Stratmann wrote: > > Am Sunday 24 April 2011 11:44:18 schrieb Rainer Stratmann: > >> How to find the return adress of the calling code of a > >> procedure/function? > >> > >> Where in the stack is the information to the return adress? > >> > >> stack + - x? > > > > asm > > mov eax , [ ebp + 4 ] > > end; > > > > eax is the return adress > > This will only work on i386 and might even work only with certain > calling conventions (don't know exactly whether other calling > conventions on i386 don't use EAX for the result value). > > >> How to acess to the information in assembler? > >> Is it in every processor architecture possible, for example ARM? > >> (actually 80x86). > >> Is it different in 32 / 64 bit? > > Why don't you try this: > http://www.freepascal.org/docs-html/rtl/system/get_caller_addr.html
Because I didn't know before :-) function get_caller_addr( framebp : pointer ) : pointer; What does framepb mean? > Regards, > Sven > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal