bfd Mach-O DWARF debugging support
Iain Sandoe
idsandoe@googlemail.com
Sun Apr 8 10:24:00 GMT 2012
Hi Albert,
On 8 Apr 2012, at 11:07, Albert Zeyer wrote:
> It seems that the binary references to `.o` files.
Yes and I believe that we have partial support already in gdb, but
maybe not elsewhere in binutils (Tristan would know better).
however...
> That is also where
> `dsymutil` is collecting its debug info from.
.. the reason for dsymutil's existence is that when you do "gcc foo.c -
g -o foo" the intermediate object files are temporary - deleted at the
end of the compile - so that they cannot be found later for debug etc.
dsymutil intercepts them before they are removed and copies the debug
info.
if you build every source with "-c" and then link separately this
problem might not arise (providing you keep the .o files where they
were built).
if you are doing a single file with a c/l like about - one thing you
can try is to add "-save-temps" so that the intermediate object is
saved.
(or dsymutil, of course)
however, AFAIR, Apple's gcc automatically invokes dsymutil when "-g*"
is on the c/l for Darwin >= 9 (osx 10.5) or if -g-dwarf* is explicitly
stated.
FSF GCC also does the same (and for a wider range of languages).
> Apples GDB and other Apple tools read this referenced debug info.
> Maybe libbfd should too?
I am sure that there are (possibly large) gaps in our support.
It would be very nice if we had complete support for this -- patches
welcome!
(darwin has only a small group of volunteers, the more the merrier!)
cheers
Iain
> Regards,
> Albert
>
>
> On Fri, Apr 6, 2012 at 5:13 AM, Albert Zeyer <albzey@googlemail.com>
> wrote:
>> Hi,
>>
>> I was wondering about the current state of the Mach-O DWARF debugging
>> support. I saw some patches recently which implemented
>> `bfd_mach_o_find_nearest_line` (that is mostly what I am interested
>> in).
>>
>> I have a binary which was build via `gcc -gdwarf-2` (Apples GCC).
>>
>> I tried binutils-2.22.52 but it doesn't really work for me. I tried
>> to
>> debug it a bit. Some things I can say so far:
>>
>> * `objdump -g` doesn't output anything regarding debugging info.
>> * In bfd/dwarf2.c, in find_line(), _bfd_dwarf2_slurp_debug_info
>> returns false.
>> * In _bfd_dwarf2_slurp_debug_info(), find_debug_info returns false.
>> * `objdump -h` doesn't list any debug section.
>>
>> When I use `dsymutil` to generate a dSYM from my binary,
>> `bfd_mach_o_find_nearest_line` works.
>>
>> Can somebody give some hints wether it should work or about the
>> current state?
>>
>> Regards,
>> Albert
More information about the Binutils
mailing list