Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Jordan Rupprecht <rupprecht@google.com>
Cc: gdb-patches@sourceware.org, Eric Christopher <echristo@gmail.com>,
	       David Blaikie <dblaikie@gmail.com>,
	dje@google.com
Subject: Re: [PATCH] [dwarf2read] Fix crash when loading dwp files: calculate num_sections based on actual section indices, not just the number of sections.
Date: Mon, 25 Feb 2019 20:55:00 -0000	[thread overview]
Message-ID: <1b6df15638153631ea87fa1bc7c24dd2@polymtl.ca> (raw)
In-Reply-To: <CABC7LbQ27C=fDcj=btTFkDY1q2GVNz9R9Qp0XRhweAnnc2--2A@mail.gmail.com>

On 2019-02-25 15:21, Jordan Rupprecht wrote:
> Sorry, patch somehow didn't make it in the previous message. Including
> it manually:
> 
> ---
>  gdb/ChangeLog    | 6 ++++++
>  gdb/dwarf2read.c | 3 +--
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index 118f17588a..c2340e694c 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,3 +1,9 @@
> +2019-02-25  Jordan Rupprecht  <rupprecht@google.com>
> +
> +       * dwarf2read.c (open_and_init_dwp_file): Call
> +       elf_numsections instead of bfd_count_sections to initialize
> +       dwp_file->num_sections.
> +
>  2019-02-25  Tom Tromey  <tromey@adacore.com>
> 
>         * solib-darwin.c (darwin_get_dyld_bfd): Don't release dyld_bfd.
> diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
> index 98f46e0416..2908a233fe 100644
> --- a/gdb/dwarf2read.c
> +++ b/gdb/dwarf2read.c
> @@ -13230,8 +13230,7 @@ open_and_init_dwp_file (struct
> dwarf2_per_objfile *dwarf2_per_objfile)
>    std::unique_ptr<struct dwp_file> dwp_file
>      (new struct dwp_file (name, std::move (dbfd)));
> 
> -  /* +1: section 0 is unused */
> -  dwp_file->num_sections = bfd_count_sections (dwp_file->dbfd) + 1;
> +  dwp_file->num_sections = elf_numsections (dwp_file->dbfd);
>    dwp_file->elf_sections =
>      OBSTACK_CALLOC (&objfile->objfile_obstack,
>                     dwp_file->num_sections, asection *);
> --
> 2.21.0.rc0.258.g878e2cd30e-goog

I have tweaked the original commit message a bit and pushed.

Thanks again for the patch.

Simon


  reply	other threads:[~2019-02-25 20:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-23  0:54 Jordan Rupprecht via gdb-patches
2019-02-24  4:01 ` Simon Marchi
2019-02-25 20:17   ` Jordan Rupprecht via gdb-patches
2019-02-25 20:21     ` Jordan Rupprecht via gdb-patches
2019-02-25 20:55       ` Simon Marchi [this message]
2019-02-25 21:22         ` Jordan Rupprecht via gdb-patches
2019-02-26 15:08         ` Tom Tromey
2019-02-26 16:24           ` Simon Marchi
2019-02-27  4:41             ` Simon Marchi
2019-02-27 17:22               ` Tom Tromey
2019-02-27 17:40                 ` Simon Marchi
2019-02-27 17:56                   ` Eric Christopher
2019-02-27 18:06                     ` Adrian Prantl
2019-02-27 18:13                       ` Simon Marchi
2019-02-27 19:33                       ` David Blaikie
2019-02-25 20:21     ` Simon Marchi

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=1b6df15638153631ea87fa1bc7c24dd2@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=dblaikie@gmail.com \
    --cc=dje@google.com \
    --cc=echristo@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=rupprecht@google.com \
    /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