public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/31650] New: Dummy CUs Need A DW_AT_compile_unit DIE
@ 2024-04-17 14:44 hawkinsw at obs dot cr
  2024-04-17 14:47 ` [Bug testsuite/31650] Dummy CUs Need A DW_TAG_compile_unit DIE hawkinsw at obs dot cr
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: hawkinsw at obs dot cr @ 2024-04-17 14:44 UTC (permalink / raw)
  To: gdb-prs

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug testsuite/31650] Dummy CUs Need A DW_TAG_compile_unit DIE
  2024-04-17 14:44 [Bug testsuite/31650] New: Dummy CUs Need A DW_AT_compile_unit DIE hawkinsw at obs dot cr
@ 2024-04-17 14:47 ` hawkinsw at obs dot cr
  2024-04-17 14:54 ` hawkinsw at obs dot cr
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: hawkinsw at obs dot cr @ 2024-04-17 14:47 UTC (permalink / raw)
  To: gdb-prs

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

Will Hawkins <hawkinsw at obs dot cr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Dummy CUs Need A            |Dummy CUs Need A
                   |DW_AT_compile_unit DIE      |DW_TAG_compile_unit DIE

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug testsuite/31650] Dummy CUs Need A DW_TAG_compile_unit DIE
  2024-04-17 14:44 [Bug testsuite/31650] New: Dummy CUs Need A DW_AT_compile_unit DIE hawkinsw at obs dot cr
  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
  3 siblings, 0 replies; 5+ messages in thread
From: hawkinsw at obs dot cr @ 2024-04-17 14:54 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Will Hawkins <hawkinsw at obs dot cr> ---
FYI: https://sourceware.org/pipermail/gdb-patches/2024-April/208197.html

PS: I hope that I have navigated the interaction between Bugzilla and
gdb-patches@ correctly. I am trying to follow all the rules. 

Thanks for everything!
Will

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug testsuite/31650] Dummy CUs Need A DW_TAG_compile_unit DIE
  2024-04-17 14:44 [Bug testsuite/31650] New: Dummy CUs Need A DW_AT_compile_unit DIE hawkinsw at obs dot cr
  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
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-18 11:28 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=41d5ff24c6723b87ada11c1287f50cb87f7d89e2

commit 41d5ff24c6723b87ada11c1287f50cb87f7d89e2
Author: Will Hawkins <hawkinsw@obs.cr>
Date:   Thu Apr 18 13:28:52 2024 +0200

    Add DW_TAG_compile_unit DIE to Dummy CUs

    Dummy CUs help detect errors and are very helpful. However, the DWARF
    spec seems to indicate the CUs need a DW_TAG_compile_unit in addition to
    the header. This patch adds that.

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

    Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
    Approved-By: Tom de Vries <tdevries@suse.de>
    Tested-By: Tom de Vries <tdevries@suse.de>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug testsuite/31650] Dummy CUs Need A DW_TAG_compile_unit DIE
  2024-04-17 14:44 [Bug testsuite/31650] New: Dummy CUs Need A DW_AT_compile_unit DIE hawkinsw at obs dot cr
                   ` (2 preceding siblings ...)
  2024-04-18 11:28 ` cvs-commit at gcc dot gnu.org
@ 2024-04-18 11:29 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2024-04-18 11:29 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |15.1
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-18 11:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-17 14:44 [Bug testsuite/31650] New: Dummy CUs Need A DW_AT_compile_unit DIE hawkinsw at obs dot cr
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

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).