From owner-freebsd-hackers Sun Jul 18 12:28: 4 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from flood.ping.uio.no (flood.ping.uio.no [129.240.78.31]) by hub.freebsd.org (Postfix) with ESMTP id 03F4914E50 for ; Sun, 18 Jul 1999 12:28:01 -0700 (PDT) (envelope-from des@flood.ping.uio.no) Received: (from des@localhost) by flood.ping.uio.no (8.9.3/8.9.1) id VAA55297; Sun, 18 Jul 1999 21:27:18 +0200 (CEST) (envelope-from des) To: Alfred Perlstein Cc: Dag-Erling Smorgrav , hackers@FreeBSD.ORG Subject: Re: Determining the return address References: From: Dag-Erling Smorgrav Date: 18 Jul 1999 21:27:18 +0200 In-Reply-To: Alfred Perlstein's message of "Sun, 18 Jul 1999 14:13:02 -0500 (EST)" Message-ID: Lines: 28 X-Mailer: Gnus v5.5/Emacs 19.34 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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. DES -- Dag-Erling Smorgrav - des@flood.ping.uio.no To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message