Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH v2] [gdb/symtab] Fix dwarf version of DWO TU
Date: Mon, 20 Jan 2025 09:57:23 +0100	[thread overview]
Message-ID: <20250120085723.5693-1-tdevries@suse.de> (raw)

When running test-case gdb.ada/access_tagged_param.exp with target board
fission, we run into:
...
(gdb) break pck.adb:19^M
gdb/dwarf2/read.h:289: internal-error: version: \
  Assertion `m_dwarf_version != 0' failed.^M
...

The assertion happens when calling cu->per_cu->version () in this workaround
in read_subroutine_type:
...
  /* PR gas/29517 occurs in 2.39, and is fixed in 2.40, but it's only fixed
     for dwarf version >= 3 which supports DW_TAG_unspecified_type.  */
  if (type->code () == TYPE_CODE_VOID
      && !type->is_stub ()
      && die->child == nullptr
      && (cu->per_cu->version () == 2
	  || producer_is_gas_2_39 (cu)))
    {
...
for a TU in a dwo file.

Fix this by using cu->header.version instead.

Tested on aarch64-linux.

PR symtab/32309
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32309
---
 gdb/dwarf2/read.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 4503977d62b..824604261f5 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -14019,7 +14019,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
   if (type->code () == TYPE_CODE_VOID
       && !type->is_stub ()
       && die->child == nullptr
-      && (cu->per_cu->version () == 2
+      && (cu->header.version == 2
 	  || producer_is_gas_2_39 (cu)))
     {
       /* Work around PR gas/29517, pretend we have an DW_TAG_unspecified_type

base-commit: c99345db064e1bd645bc08db65174bae7ac20b0e
-- 
2.43.0


             reply	other threads:[~2025-01-20  8:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-20  8:57 Tom de Vries [this message]
2025-01-21 13:32 ` Tom Tromey
2025-01-21 15:09   ` Tom de Vries
2025-03-03 20:02     ` Simon Marchi
2025-03-03 20:44       ` Simon Marchi
2025-03-03 21:22         ` 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=20250120085723.5693-1-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@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