public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug symtab/29334] [gdb, debug-types, debug-names] segfault in dwarf2_per_objfile::symtab_set_p
Date: Fri, 08 Jul 2022 07:28:33 +0000	[thread overview]
Message-ID: <bug-29334-4717-szUjjLxwui@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29334-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=29334

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Yep, that fixes it:
...
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 23fe5679cbd..9f92b420645 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -4991,7 +4991,11 @@ dw2_debug_names_iterator::next ()
                         objfile_name (objfile));
              continue;
            }
-         per_cu = per_bfd->get_cu (ull + per_bfd->tu_stats.nr_tus);
+         {
+           int nr_cus = (per_bfd->all_comp_units.size ()
+                         - per_bfd->tu_stats.nr_tus);
+           per_cu = per_bfd->get_cu (nr_cus + ull);
+         }
          break;
        case DW_IDX_die_offset:
          /* In a per-CU index (as opposed to a per-module index), index
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2022-07-08  7:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-08  7:04 [Bug symtab/29334] New: " vries at gcc dot gnu.org
2022-07-08  7:24 ` [Bug symtab/29334] " vries at gcc dot gnu.org
2022-07-08  7:28 ` vries at gcc dot gnu.org [this message]
2022-07-08 10:02 ` vries at gcc dot gnu.org
2022-07-08 13:59 ` vries at gcc dot gnu.org
2022-07-08 14:00 ` vries at gcc dot gnu.org
2022-07-12 12:22 ` vries at gcc dot gnu.org

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=bug-29334-4717-szUjjLxwui@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).