What I'm trying now is making the file/line number lookup code do so
for the stack as a whole -- each `lookup' method in NameFinder would
receive the entire stack trace and an array of objects to store the
info it finds for each frame, skipping frames that have already been
filled in. Then I call each in a precedence order -- interpreted,
DWARF-2 info, dladdr, and finally (not implemented yet) addr2line.
This makes the DWARF-2 part much faster, since it can optimize out of
having to read things more than once. It also has room for inserting
other methods for finding debug info; it isn't "pluggable", but it
could be.
Bryce> I think reading the .debug_line info directly is definitely the
Bryce> right solution. My only concern is this: + * DWARF-2 reading by
Bryce> Casey Marshall <csm@gnu.org>. ELF info reading + * based on
Bryce> elf/sprof.c from glibc-2.3.2, written by Ulrich Drepper + * and
Bryce> Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc.
Bryce> Are we allowed to use this ELF code? Do we need to get special
Bryce> permission from the FSF to use/relicense it?
Maybe, that was one of my open questions about this. The code I used
from glibc was very small -- basically a cluestick about how to mmap
the ELF headers, and how to find and inspect section names.
I could rewrite this part if need be, since I have a better grasp of
ELF than when I started this.