Subject: Re: sanity checking arguments to library functions...
To: Chris G. Demetriou <cgd@netbsd.org>
From: Brian C. Grayson <bgrayson@marvin.ece.utexas.edu>
List: tech-userlevel
Date: 04/13/1999 18:18:28
On Tue, Apr 13, 1999 at 02:05:20PM -0700, Chris G. Demetriou wrote:
> what's the purpose of these messages?
> 
> is it to provide a developer with feedback so that they can get
> diagnostic information about a a problem that they can't reproduce?
> the problem with any of these is that it may tell you which assertion
> you've hit, but it won't tell you anything about the caller, etc, so
> the debugging utility is useless.

  It Is Possible for any given function to print a stack trace of
all of its callers' addresses, modulo a heuristic or two.  This
information can then be fed post-mortem to addr2line, if the
executable has sufficient symbols, to extract exact source line
info.  If the executable has only function symbols, a simple
search can tell you at least what function each call occurred in.

  I've implemented a stack dump in such a way that it works
for any gcc/egcs-compiled program, and I'm sure others have done
similar stuff.  Interested parties can contact me off-line for
more details.  With this functionality, an abort actually
provides _some_ useful info.

  Brian