From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 28268383A80F; Wed, 11 Aug 2021 12:00:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 28268383A80F From: "gprocida at google dot com" To: elfutils-devel@sourceware.org Subject: [Bug libdw/28220] New: dwarf_location_attr returns high-bit junk from .debug_addr when fetching 32-bit addresses Date: Wed, 11 Aug 2021 12:00:35 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: elfutils X-Bugzilla-Component: libdw X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gprocida at google dot com 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 X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Aug 2021 12:00:36 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28220 Bug ID: 28220 Summary: dwarf_location_attr returns high-bit junk from .debug_addr when fetching 32-bit addresses Product: elfutils Version: unspecified Status: UNCONFIRMED Severity: normal Priority: P2 Component: libdw Assignee: unassigned at sourceware dot org Reporter: gprocida at google dot com CC: elfutils-devel at sourceware dot org Target Milestone: --- In libdw, there are snippets of code of the form: dwarf_formaddr.c: 71 if (address_size =3D=3D 4) 72 *addr =3D read_4ubyte_unaligned (dbg, datap); 73 else 74 *addr =3D read_8ubyte_unaligned (dbg, datap); However, when I use the public interfaces in order to read locations, it go= es wrong when for Clang-built 32-bit objects with DWARF 5 debug information, w= ith extra junk in the upper 32 bits. The attachment contains a full example. It's possible that I'm using the API incorrectly. This is the debug output for the problematic case: clang 5 32 bias=3D0 bias=3D0 dwarf=3D0x55f103cf8a10 elf=3D0x55f103cf5610 version=3D5 unit_type=3D1 cu_die.addr=3D0x7fc3032e0078 cu_die.cu=3D0x55f10= 3cf8e98 cu_die.abbrev=3D0 sub_die.addr=3D0 sub_die.cu=3D0 sub_die.abbrev=3D0 unit_id=3D0 address_size=3D4 offset_size=3D4 dwarf_string_attr(die, 1b) comp_dir=3D/usr/local/google/home/gprocida/dev/libabigail/b195152239 child.addr=3D0x7fc3032e008a child.cu=3D0x55f103cf8e98 child.abbrev=3D0 dwarf_string_attr(die, 3) dwarf_bool_attr(die, 3f) dwarf_location_attr(die, 2) attribute code=3D0x2 form=3D0x18 (expected=3D18) expr=3D0x55f103cf8ff8 exprlen=3D1 op.atom=3Da1 op.number=3D0 op.number2=3D0 op.offset=3D0 result code=3D0x11 form=3D0x1 (expected=3D1) address=3D0x1000400010000 variable name=3Dx name2=3Dx external=3D1 location=3D1000400010000 child.addr=3D0x7fc3032e0095 child.cu=3D0x55f103cf8e98 child.abbrev=3D0 child.addr=3D0x7fc3032e0099 child.cu=3D0x55f103cf8e98 child.abbrev=3D0 dwarf_string_attr(die, 3) dwarf_bool_attr(die, 3f) dwarf_location_attr(die, 2) attribute code=3D0x2 form=3D0x18 (expected=3D18) expr=3D0x55f103cf9048 exprlen=3D1 op.atom=3Da1 op.number=3D1 op.number2=3D0 op.offset=3D0 result code=3D0x11 form=3D0x1 (expected=3D1) address=3D0x6265440000010004 variable name=3Dy name2=3Dy external=3D1 location=3D6265440000010004 Note that variable x's address includes variable y's address as the upper 32 bits and that variable y has junk in the upper 32 bits. --=20 You are receiving this mail because: You are on the CC list for the bug.=