public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "hawkinsw at obs dot cr" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug testsuite/31650] New: Dummy CUs Need A DW_AT_compile_unit DIE
Date: Wed, 17 Apr 2024 14:44:51 +0000 [thread overview]
Message-ID: <bug-31650-4717@http.sourceware.org/bugzilla/> (raw)
https://sourceware.org/bugzilla/show_bug.cgi?id=31650
Bug ID: 31650
Summary: Dummy CUs Need A DW_AT_compile_unit DIE
Product: gdb
Version: HEAD
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: testsuite
Assignee: unassigned at sourceware dot org
Reporter: hawkinsw at obs dot cr
CC: vries at gcc dot gnu.org
Target Milestone: ---
In Bug 28235, Tom de Vries added support for "dummy CUs" in order for the
.debug_info from `Dwarf::assemble` to have CUs _at least_ at the very
beginning and very end. It has been helpful sussing out extra bugs.
Unfortunately, those dummy CUs did not contain any DIEs -- they contained only
the header. The standard seems to indicate that the header be followed by a
DW_TAG_compile_unit or a DW_TAG_partial_unit:
> For each compilation unit compiled with a DWARF producer, a contribution is33
> made to the .debug_info section of the object file. Each such contribution34
> consists of a compilation unit header (see Section 7.5.1.1 on page 200) followed
> by a single DW_TAG_compile_unit or DW_TAG_partial_unit debugging
> information entry, together with its children.
(Taken from 198-199 of https://dwarfstd.org/doc/DWARF5.pdf).
As a result, the binaries that include dummy CUs cause llvm-dwarfdump to emit
warnings. For instance, with the main-suprogram test case:
```
hawkinsw@ininer:~/code/binutils-build/gdb/testsuite/outputs$ llvm-dwarfdump
./gdb.dwarf2/main-subprogram/main-subprogram
./gdb.dwarf2/main-subprogram/main-subprogram: file format elf64-x86-64
.debug_info contents:
0x00000000: Compile Unit: length = 0x00000007, format = DWARF32, version =
0x0004, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x0000000b)
warning: DWARF unit from offset 0x00000000 incl. to offset 0x0000000b excl.
tries to read DIEs at offset 0x0000000b
<compile unit can't be parsed!>
...
```
The fix seems to be easy. Adding an empty
```
compile_unit {}
```
in the dummy_cu proc in lib/dwarf.exp.
I have a patch about to be send to gdb-patches@ and have tested on
x86_64-redhat-linux.
--
You are receiving this mail because:
You are on the CC list for the bug.
next reply other threads:[~2024-04-17 14:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-17 14:44 hawkinsw at obs dot cr [this message]
2024-04-17 14:47 ` [Bug testsuite/31650] Dummy CUs Need A DW_TAG_compile_unit DIE hawkinsw at obs dot cr
2024-04-17 14:54 ` hawkinsw at obs dot cr
2024-04-18 11:28 ` cvs-commit at gcc dot gnu.org
2024-04-18 11:29 ` 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-31650-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).