BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Getting caller function's address

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++)
View previous topic :: View next topic  
Author Message
Sally
Guest





PostPosted: Thu Aug 04, 2005 8:26 am    Post subject: Getting caller function's address Reply with quote



During runtime, without Borland IDE, I would like to get the caller
function's address (or the exact address where the function was called
from), mainly so that my error popups can show not only the address of
the exception (which is often useless if in a low level function like
"lock" which is used for many things) but also the address of the
caller.

If I can crawl even further up the chain that would be great, but at
least 1 up the chain is enough for now.


Back to top
Tales Aguiar
Guest





PostPosted: Thu Aug 04, 2005 10:02 pm    Post subject: Re: Getting caller function's address Reply with quote



You can get this information examining the stack. But it's not easy because
the stack frame that sometimes are created.

The function that catch the exception always have stack frame, in this
function you can do it:

void *Caller;
asm
{
mov eax, [ebp+4]
mov Caller, eax
}

something like it. I don't test.

See http://www.codeproject.com/cpp/exceptionhandler.asp for more
information, this talk about handling exception and stack frame for VC. I
don't found nothing for borland.


Tales Aguiar

"Sally" <nospamforme (AT) spamme (DOT) com> wrote

Quote:
During runtime, without Borland IDE, I would like to get the caller
function's address (or the exact address where the function was called
from), mainly so that my error popups can show not only the address of
the exception (which is often useless if in a low level function like
"lock" which is used for many things) but also the address of the
caller.

If I can crawl even further up the chain that would be great, but at
least 1 up the chain is enough for now.





Back to top
tinyabs
Guest





PostPosted: Fri Aug 05, 2005 5:47 am    Post subject: Re: Getting caller function's address Reply with quote



www.madshi.net - for Delphi and BCB


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.