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/29323] New: [gdb/symtab] read.c:3963: internal-error: dw2_expand_symtabs_matching_one: Assertion `symtab != nullptr' failed.
Date: Wed, 06 Jul 2022 14:28:32 +0000	[thread overview]
Message-ID: <bug-29323-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 29323
           Summary: [gdb/symtab] read.c:3963: internal-error:
                    dw2_expand_symtabs_matching_one: Assertion `symtab !=
                    nullptr' failed.
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

With test-case gdb.dwarf2/struct-with-sig.exp and target board
cc-with-debug-names I run into:
...
(gdb) ptype struct s^M
/home/vries/gdb_versions/devel/src/gdb/dwarf2/read.c:3963: internal-error:
dw2_expand_symtabs_matching_one: Assertion `symtab != nullptr' failed.^M
A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
----- Backtrace -----^M
FAIL: gdb.dwarf2/struct-with-sig.exp: struct s with int i (GDB internal error)
...

This is easily enough fixed by:
...
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 017cde0dcd9..97be0aaa0db 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -3960,9 +3960,8 @@ dw2_expand_symtabs_matching_one

       compunit_symtab *symtab
        = dw2_instantiate_symtab (per_cu, per_objfile, false);
-      gdb_assert (symtab != nullptr);

-      if (expansion_notify != NULL && symtab_was_null)
+      if (symtab != nullptr && expansion_notify != NULL && symtab_was_null)

        return expansion_notify (symtab);
     }
   return true;
...

Still, we're trying to print struct s, in the context of main, which has a
struct s decl with sig reference to a struct s in a TU.

So why are we're trying to instantiate the dummy CU at offset 0x9a:
...
  Compilation Unit @ offset 0x8f:
   Length:        0x7 (32-bit)
   Version:       4
   Abbrev Offset: 0x59
   Pointer Size:  8
  Compilation Unit @ offset 0x9a:
...
which contains no symbols and is indeed not listed as containing any symbols in
the .debug_names index?

Is this because the index is missing information?  That is, it has:
...
[ 15] #0002b618 s:
        <5> DW_TAG_structure_type DW_IDX_type_unit=0 DW_IDX_GNU_internal=1
        <5> DW_TAG_structure_type DW_IDX_type_unit=1 DW_IDX_GNU_internal=1
...
but there's no indication that the foo and main compilation units also contain
those types (using aforementioned decl-with-sig-ref).

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

             reply	other threads:[~2022-07-06 14:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-06 14:28 vries at gcc dot gnu.org [this message]
2022-07-06 14:28 ` [Bug symtab/29323] " vries at gcc dot gnu.org
2022-07-08  7:39 ` 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-29323-4717@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).