From owner-freebsd-hackers Sun Jul 18 21:51:41 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from xylan.com (postal.xylan.com [208.8.0.248]) by hub.freebsd.org (Postfix) with ESMTP id 7B57414EAC for ; Sun, 18 Jul 1999 21:51:38 -0700 (PDT) (envelope-from wes@softweyr.com) Received: from mailhub.xylan.com by xylan.com (8.8.7/SMI-SVR4 (xylan-mgw 2.2 [OUT])) id VAA01195; Sun, 18 Jul 1999 21:49:00 -0700 (PDT) Received: from omni.xylan.com by mailhub.xylan.com (SMI-8.6/SMI-SVR4 (mailhub 2.1 [HUB])) id VAA14386; Sun, 18 Jul 1999 21:48:54 -0700 Received: from softweyr.com ([204.68.178.39]) by omni.xylan.com (4.1/SMI-4.1 (xylan engr [SPOOL])) id AA15253; Sun, 18 Jul 99 21:48:56 PDT Message-Id: <3792AE44.9CAC4953@softweyr.com> Date: Sun, 18 Jul 1999 22:49:08 -0600 From: Wes Peters Organization: Softweyr LLC X-Mailer: Mozilla 4.5 [en] (X11; U; FreeBSD 3.1-RELEASE i386) X-Accept-Language: en Mime-Version: 1.0 To: Alfred Perlstein Cc: Dag-Erling Smorgrav , hackers@FreeBSD.ORG Subject: Re: Determining the return address References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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