Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Jordan Rupprecht via gdb-patches" <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Cc: Eric Christopher <echristo@gmail.com>,
	David Blaikie <dblaikie@gmail.com>,
	dje@google.com, 	simon.marchi@polymtl.ca
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:21:00 -0000	[thread overview]
Message-ID: <CABC7LbQ27C=fDcj=btTFkDY1q2GVNz9R9Qp0XRhweAnnc2--2A@mail.gmail.com> (raw)
In-Reply-To: <20190225201715.144927-1-rupprecht@google.com>

[-- Attachment #1: Type: text/plain, Size: 1318 bytes --]

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

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4849 bytes --]

  reply	other threads:[~2019-02-25 20:21 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 [this message]
2019-02-25 20:55       ` Simon Marchi
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='CABC7LbQ27C=fDcj=btTFkDY1q2GVNz9R9Qp0XRhweAnnc2--2A@mail.gmail.com' \
    --to=gdb-patches@sourceware.org \
    --cc=dblaikie@gmail.com \
    --cc=dje@google.com \
    --cc=echristo@gmail.com \
    --cc=rupprecht@google.com \
    --cc=simon.marchi@polymtl.ca \
    /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