From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A890F3858D39; Wed, 17 Apr 2024 14:44:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A890F3858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1713365092; bh=O1sMnVXpCw+Vsxi9d2rGDOSo1Ityj8RuFUra3MLYvV0=; h=From:To:Subject:Date:From; b=CjdYLcIiiicKqm+LfNOhsmvAvBmeM2huUizGBCHHj8jRJTbzMuHXFNUdoLooG2tG/ Z6c/9eWT+Ztx1uPNN/bb39qsa2KgFplPW4NpEIHAAQO5FtX6Mj7RaQtk92iG5Lw00U 1qtniCKfGfutGJ9NPXhVms2Q5bIkfb0EVKoCW80M= From: "hawkinsw at obs dot cr" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: testsuite X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hawkinsw at obs dot cr X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31650 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 o= nly 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 contributio= n34 > consists of a compilation unit header (see Section 7.5.1.1 on page 200) f= ollowed > 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).=20 As a result, the binaries that include dummy CUs cause llvm-dwarfdump to em= it 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 =3D 0x00000007, format =3D DWARF32, versio= n =3D 0x0004, abbr_offset =3D 0x0000, addr_size =3D 0x08 (next unit at 0x0000000b) warning: DWARF unit from offset 0x00000000 incl. to offset 0x0000000b excl. tries to read DIEs at offset 0x0000000b ... ``` 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. --=20 You are receiving this mail because: You are on the CC list for the bug.=