From owner-freebsd-hackers Sun Jul 18 13: 4: 6 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from cygnus.rush.net (cygnus.rush.net [209.45.245.133]) by hub.freebsd.org (Postfix) with ESMTP id BBACF14A2D for ; Sun, 18 Jul 1999 13:03:58 -0700 (PDT) (envelope-from bright@rush.net) Received: from localhost (bright@localhost) by cygnus.rush.net (8.9.3/8.9.3) with SMTP id QAA25198; Sun, 18 Jul 1999 16:12:21 -0400 (EDT) Date: Sun, 18 Jul 1999 15:12:19 -0500 (EST) From: Alfred Perlstein To: Dag-Erling Smorgrav Cc: hackers@FreeBSD.ORG Subject: Re: Determining the return address In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 18 Jul 1999, Dag-Erling Smorgrav wrote: > Alfred Perlstein writes: > > On 18 Jul 1999, Dag-Erling Smorgrav wrote: > > > Alfred Perlstein 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