Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Jul 1999 15:12:19 -0500 (EST)
From:      Alfred Perlstein <bright@rush.net>
To:        Dag-Erling Smorgrav <des@flood.ping.uio.no>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Determining the return address
Message-ID:  <Pine.BSF.3.96.990718150947.14320h-100000@cygnus.rush.net>
In-Reply-To: <xzpvhbhn4h5.fsf@flood.ping.uio.no>

next in thread | previous in thread | raw e-mail | index | archive | help
On 18 Jul 1999, Dag-Erling Smorgrav wrote:

> Alfred Perlstein <bright@rush.net> writes:
> > On 18 Jul 1999, Dag-Erling Smorgrav wrote:
> > > Alfred Perlstein <bright@rush.net> writes:
> > > >                                                  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...
> > > I know - I don't expect it to be portable.
> > *slap* :)
> 
> It's #ifdef'ed so you can drop it on platforms where it doesn't work :)
> 
> > > > gdb and glibc have some functions to assist in runtime backtraces,
> > > > perhaps a look there may help?
> > > I found out about __builtin_return_address(0).
> > what is that? a function? available on freebsd?
> 
> GCC builtin function.
> 
> > by setting an alternate signal stack i think you can check
> > if you are in a signal using this.  this may not be the best way
> > but it seems like a viable solution.
> 
> Hmm, I ended up using a global variable which I increment at the
> beginning of the signal handler, and decrement at the end.

As long as you make sure the code won't have multiple access
that would work.

-Alfred



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?Pine.BSF.3.96.990718150947.14320h-100000>