public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* libbfd Mac OS X support?
@ 2006-05-01  0:11 Ethan Tira-Thompson
  2006-05-01  0:29 ` Eric Christopher
  0 siblings, 1 reply; 2+ messages in thread
From: Ethan Tira-Thompson @ 2006-05-01  0:11 UTC (permalink / raw)
  To: binutils

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: libbfd Mac OS X support?
  2006-05-01  0:11 libbfd Mac OS X support? Ethan Tira-Thompson
@ 2006-05-01  0:29 ` Eric Christopher
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Christopher @ 2006-05-01  0:29 UTC (permalink / raw)
  To: Ethan Tira-Thompson; +Cc: binutils


>     ??: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...?)

There's a copy of bfd in the Apple version of gdb that has some  
functionality, but...

> 2. Is bfd_find_nearest_line simply unimplemented on OS X, or is  
> there something deeper?

Something deeper. Mostly bfd is unsupported for OS X unfortunately.

> 3. Do you know how GDB extracts line info?  (i.e. suggestions for  
> workaround/next step?)

I'd suggest using the bfd work for OS X available from the Apple  
version of gdb.

-eric

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-05-01  0:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-01  0:11 libbfd Mac OS X support? Ethan Tira-Thompson
2006-05-01  0:29 ` Eric Christopher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).