Subject: Re: sanity checking arguments to library functions...
To: Julian Assange <>
From: Brian C. Grayson <>
List: tech-userlevel
Date: 04/16/1999 13:10:54
On Fri, Apr 16, 1999 at 11:49:58PM +1000, Julian Assange wrote:
> Can we see this in the tree, brian?

  Two problems:
  1.  My current stuff prints the return addresses, and then you
      can use addr2line to go from that to function, file, line#
      (if the exec was compiled with -g).  The code to dump the
      return addresses is on the order of 20 lines, and is
      purely my own creation, so it can be BSD-licensed.

      All of this functionality (dump + addr2line) could be
      folded into a C routine, but would require
      a)  code based heavily on addr2line, and thus the code
	would probably have to be GPL'd.
      b)  linking with -lbfd.

      The cleanest thing, to me, is to add such a routine to our
      libbfd, and if we feel like being nice, forwarding the code
      to the GNU folks.  From past experience, it should end up
      in binutils-4 or so....  :)

      addr2line also needs a bit of work, as it gives up a little
      too easily -- even without -g, it should be able to provide
      function names for non-stripped executables, but it
      appears that it doesn't (it seg faults, IIRC).

  2.  My PhD defense is in 4 days, and then I have job interviews
      and such for 3 weeks, hence my NetBSD-hacking time is minimal.

      I'll also need some assistance from people with all the
      various machines to figure out the length of a call
      instruction (5 bytes on x86, and 4 on everything RISC, but
      I don't know the others).