Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Jul 1999 22:49:08 -0600
From:      Wes Peters <wes@softweyr.com>
To:        Alfred Perlstein <bright@rush.net>
Cc:        Dag-Erling Smorgrav <des@flood.ping.uio.no>, hackers@FreeBSD.ORG
Subject:   Re: Determining the return address
Message-ID:  <3792AE44.9CAC4953@softweyr.com>
References:  <Pine.BSF.3.96.990717155538.14320Z-100000@cygnus.rush.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Alfred Perlstein wrote:
> 
> On 17 Jul 1999, Dag-Erling Smorgrav wrote:
> 
> > Is there any (evidently non-portable) way of determining a function
> > instance's return address? I have an idea or two that involves the
> > return address and dladdr(). The code I currently use looks like this:
> 
> This looks like what you are doing is trying to grab the data on the
> stack before "log" which is the return address.  I doubt this is
> at all portable and may fail because of optimizations and ABI, such
> as archs that store the return address in a register...

On the SPARC, FWIW, the return address is in %i7.  What is difficult to
determine (programmatically) is if the function is a normal or leaf function; 
different return sequences are used for each.

-- 
            "Where am I, and what am I doing in this handbasket?"

Wes Peters                                                         Softweyr LLC
http://softweyr.com/                                           wes@softweyr.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3792AE44.9CAC4953>