libbfd Mac OS X support?
Ethan Tira-Thompson
ejt@andrew.cmu.edu
Mon May 1 00:11:00 GMT 2006
I was hoping someone could give me a heads up on the status of libbfd
for Mac OS X.
I've written a nice (IMHO) little bit of code that can do stack
unrolling on a variety of platforms -- my aim is to provide a C/C++
debugging capability similar to what is found in Java, where it dumps
a stack trace any time something goes wrong. But this would be far
more user friendly if the stack trace includes the actual function
names and filename:linenumber in the output instead of just
displaying raw return addresses. libbfd seems the sensible choice to
pull the information out of the executable (assuming it was compiled
with -g of course).
So I've gotten this all working under linux (thanks to looking at the
source of addr2line to get around a few rough edges!), but I seem to
be at an impasse with OS X because bfd_find_nearest_line maps to
_bfd_nosymbols_find_nearest_line, which in turn maps to bfd_false,
which does nothing ;) E.g.: addr2line does compile under OS X, it
just doesn't seem to work:
./addr2line -f -e ../../../trace_test 0x3f1c
??
??:0
However, I see GDB is somehow able to extract file/function info, and
afaik, it's using libbfd...
1. Which copy of bfd should I be linking against (i.e. the one in
gcc, or gdb, or binutils...?)
2. Is bfd_find_nearest_line simply unimplemented on OS X, or is there
something deeper?
3. Do you know how GDB extracts line info? (i.e. suggestions for
workaround/next step?)
thank you for your time
-ethan
More information about the Binutils
mailing list