This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Fix immediate Darwin gdb crash
On Oct 22, 2012, at 5:39 PM, Josh Matthews wrote:
> I suspect you are correct. How can I differentiate between fat
> binaries and regular archives?
You don't really need to. Just write a specific _close_and_cleanup
function for fat binaries.
>
> Cheers,
> Josh
>
> On 22 October 2012 11:24, Tristan Gingold <gingold@adacore.com> wrote:
>>
>> On Oct 22, 2012, at 4:50 PM, Josh Matthews wrote:
>>
>>> Attempting to debug any binary on Darwin with gdb HEAD currently triggers an
>>> immediate segfault. This patch corrects that.
>>
>> Hi,
>>
>>> diff --git a/bfd/mach-o.c b/bfd/mach-o.c
>>> index 0379f4f..7c44c5a 100644
>>> --- a/bfd/mach-o.c
>>> +++ b/bfd/mach-o.c
>>> @@ -4863,6 +4863,10 @@ bfd_mach_o_close_and_cleanup (bfd *abfd)
>>> free (dsym_filename);
>>> }
>>> }
>>> + else if (bfd_get_format (abfd) == bfd_archive)
>>> + {
>>> + abfd->tdata.mach_o_fat_data = NULL;
>>> + }
>>>
>>> return _bfd_generic_close_and_cleanup (abfd);
>>> }
>>
>>
>> I may have missed something, but won't this code also be called
>> for regular mach-o archives ? Why not specially handle fat binary
>> and simply close all its members (if this is what we want).
>>
>> Tristan.
>>