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/31725] [gdb/symtab] wrong .debug_str section used in dwarf_decode_macro_bytes
Date: Mon, 13 May 2024 10:32:45 +0000	[thread overview]
Message-ID: <bug-31725-4717-W11ti7iHGe@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31725-4717@http.sourceware.org/bugzilla/>

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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
I found a bug in gcc dwarf generation (
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115066 ), and the tentative fix
makes this problem unlikely to hit.

Nevertheless, using the fixed dwarf, we run into a bug in gdb, observable, by
enabling complaints.

Fixed by:
...
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 049ee4d52ff..e2cfa46516b 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -21200,7 +21200,10 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned
int offset,
       str_offsets_section = &cu->dwo_unit->dwo_file
                               ->sections.str_offsets;
       str_section = &cu->dwo_unit->dwo_file->sections.str;
-      str_offsets_base = cu->header.addr_size;
+      if (cu->per_cu->version () <= 4)
+       str_offsets_base = 0;
+      else
+       str_offsets_base = cu->header.addr_size;
     }
   else
     {
...

FWIW, the "str_offsets_base = cu->header.addr_size" makes no sense to me atm.

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

  parent reply	other threads:[~2024-05-13 10:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10 13:40 [Bug symtab/31725] New: [gdb/symtab] vries at gcc dot gnu.org
2024-05-10 13:41 ` [Bug symtab/31725] [gdb/symtab] wrong .debug_str section used in dwarf_decode_macro_bytes vries at gcc dot gnu.org
2024-05-10 13:46 ` vries at gcc dot gnu.org
2024-05-10 14:36 ` vries at gcc dot gnu.org
2024-05-13 10:32 ` vries at gcc dot gnu.org [this message]
2024-05-13 11:58 ` vries at gcc dot gnu.org
2024-05-13 12:05 ` vries at gcc dot gnu.org
2024-05-13 15:58 ` vries at gcc dot gnu.org
2024-05-22  6:12 ` 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-31725-4717-W11ti7iHGe@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).