Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tristan Gingold <gingold@adacore.com>
To: Josh Matthews <josh@joshmatthews.net>
Cc: gdb-patches@sourceware.org
Subject: Re: Fix immediate Darwin crash
Date: Mon, 22 Oct 2012 08:53:00 -0000	[thread overview]
Message-ID: <09F586D0-BE66-420C-B7FD-FEE4E57522D4@adacore.com> (raw)
In-Reply-To: <CAOvJiVVwSLoCh613zjo0gUEhoSuhOPqkgxOS2AQZimw2FLVzeA@mail.gmail.com>


On Oct 21, 2012, at 8:57 AM, Josh Matthews wrote:

> Attempting to debug any binary on Darwin currently triggers an
> immediate segfault. This patch corrects that.

Josh,

this must be submitted on the binutils mailing list.

Tristan.

> 
> Cheers,
> Josh
> 
> 2012-10-21  Josh Matthews  <josh@joshmatthews.net>
> 
>        * mach-o.c (bfd_mach_o_close_and_cleanup): Clear tdata
>        pointer to avoid incorrect archive data deletion.
>        * archive.c (_bfd_archive_close_and_cleanup): Avoid
>        accessing archive cache data when tdata is null.
> 
> diff --git a/bfd/archive.c b/bfd/archive.c
> index 8e8fd2d..3771272 100644
> --- a/bfd/archive.c
> +++ b/bfd/archive.c
> @@ -2715,7 +2715,8 @@ _bfd_archive_close_and_cleanup (bfd *abfd)
>     {
>       bfd *nbfd;
>       bfd *next;
> -      htab_t htab;
> +      struct artdata *ardata;
> +      htab_t htab = NULL;
> 
>       /* Close nested archives (if this bfd is a thin archive).  */
>       for (nbfd = abfd->nested_archives; nbfd; nbfd = next)
> @@ -2724,7 +2725,11 @@ _bfd_archive_close_and_cleanup (bfd *abfd)
>          bfd_close (nbfd);
>        }
> 
> -      htab = bfd_ardata (abfd)->cache;
> +      ardata = bfd_ardata (abfd);
> +      if (ardata)
> +        {
> +          htab = ardata->cache;
> +        }
>       if (htab)
>        {
>          htab_traverse_noresize (htab, archive_close_worker, NULL);
> 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);
> }


      reply	other threads:[~2012-10-22  8:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-21  6:58 Josh Matthews
2012-10-22  8:53 ` Tristan Gingold [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=09F586D0-BE66-420C-B7FD-FEE4E57522D4@adacore.com \
    --to=gingold@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=josh@joshmatthews.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox