Subject: Re: sanity checking arguments to library functions...
To: Ross Harvey <>
From: Brian C. Grayson <>
List: tech-userlevel
Date: 04/16/1999 14:00:16
On Fri, Apr 16, 1999 at 10:53:29AM -0700, Ross Harvey wrote:
> If the thing works by using gcc builtins like:
>         __builtin_return_address(frameno)
> Well...actually...that doesn't work on "any gcc/egcs-compiled program"
> because the builtin isn't implemented on all architectures. (And, for  
> those that it isn't implemented for, I don't think it errors out, so
> you just get a run-time exception.)

  Do you know which NetBSD archs will choke?  It looks like it
won't work on mips.

  My code requires a semi-fixed frame format, and only
__builtin_frame_address(0) and __builtin_return_address(0).
Everything else is derived from that.

  If nothing else, the easy builtin-based frame-walking code can
be done for archs that support it.  I've been using my code
successfully with i386 and PowerPC (the CPU, not NetBSD-powerpc).
From a brief inspection, it looks like it should also work on 68k
and sparc.  And, for better or worse, those cover a nontrivial
number of NetBSD users.

  The ddb frame-walking code can be pulled out into a library,
for those archs that can't do the easy method.